Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift Module: is not a recognized Objective-C method return promise #50

Closed
paulcapelo opened this issue May 5, 2020 · 3 comments
Closed

Comments

@paulcapelo
Copy link

Hi i hope you can help me i try to create a module with swift method but it response error

i try of differents way and nothing

Error
getTOTP:tiempo:fecha:resolver:rejecter: is not a recognized Objective-C method.' was thrown while invoking getTOTP on target RNTotplibe with params (
    2502,
    2503
)
.swift
  import Foundation
@objc(RNTotplibe)
class RNTotplibe: NSObject {
    @objc(getTOTP:tiempo:fecha:resolve:reject:)
    func getTOTP(semilla: String, tiempo: String, fecha: String, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
 // let valor = generateTOTP(semilla, movingFactor: counter, codeDigits: 6)
         resolve(["yfytfvtyytyyff"]);
    }
}
.m
#import <React/RCTBridgeModule.h>
#import <CommonCrypto/CommonHMAC.h>

@interface RCT_EXTERN_MODULE(RNTotplibe, NSObject)
// RCT_EXTERN_METHOD(getTOTP:(NSString *)semilla tiempo:(NSString *)tiempo fecha:(NSString *)fecha resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject );
RCT_EXTERN_METHOD(getTOTP);
.h
#import <React/RCTBridgeModule.h>
#import <CommonCrypto/CommonHMAC.h>

https://github.com/paulcapelo/simpleTotp.git
thanks for your coments

@brody4hire
Copy link
Owner

I think this is something that should be fixed on create-react-native-module that this utility depends on. There seem to be some solutions already discussed in brody4hire/create-react-native-module#221.

@paulcapelo
Copy link
Author

yeah i does each step but not working still return error maybe you have a example thanks

@brody4hire
Copy link
Owner

I would like to keep discussion in brody4hire/create-react-native-module#221, which is now pinned with the help wanted label. I personally do not work with Swift, best to get help from others in the user community. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants