ios – React native methodology not a acknowledged goal C methodology


I’m attempting to create bridge from native module to react native. I’ve tried all errors and options associated to the identical topic with no luck to get it working

Following is my swift code

import Basis

@objc(MyModule)
class MyModule: NSObject {
    
    let mySdk = MySdkBuilder.construct()
    
    @objc func renderForm(_ intentId: String,
                          intentType: String,
                          withResolver resolve: @escaping RCTPromiseResolveBlock,
                          withRejecter reject: @escaping RCTPromiseRejectBlock) {

        let rootViewController: UIViewController?

        if #accessible(iOS 13.0, *) {
            rootViewController = (UIApplication.shared.connectedScenes.first as? UIWindowScene)?.home windows.first(the place: { $0.isKeyWindow })?.rootViewController
        } else {
            rootViewController = UIApplication.shared.delegate?.window??.rootViewController
        }

        mySdk.renderForm(
            on: rootViewController,
            intentId: intentId,
            intentType: intentType
        ) { particulars in
            do {
                resolve(particulars)
            } catch {
                let error = NSError(area: "MyDomain", code: -1, userInfo: nil)
                reject("1000", "Error message", error)
            }
        }
    }
    
}

#import "MyModule.h"

@implementation MyModule
RCT_EXPORT_MODULE()

RCT_EXTERN_METHOD(renderForm:(NSString *)intentId
                  intentType:(NSString *)intentType
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)


// Do not compile this code after we construct for the previous structure.
#ifdef RCT_NEW_ARCH_ENABLED
- (std::shared_ptr<fb::react::TurboModule>)getTurboModule:
    (const fb::react::ObjCTurboModule::InitParams &)params
{
    return std::make_shared<fb::react::NativeMyModuleSpecJSI>(params);
}
#endif

@finish

and right here is my .h file


#ifdef RCT_NEW_ARCH_ENABLED
#import "RNMyModuleSpec.h"

@interface MyModule : NSObject <NativeMyModuleSpec>
#else
#import <React/RCTBridgeModule.h>

@interface MyModule : NSObject <RCTBridgeModule>
#endif

@finish

However I obtained the next error when tried to run the app

Exception 'renderForm:intentType:withResolver:withRejecter: is just not a acknowledged Goal-C methodology.' was thrown whereas invoking renderForm on track MyModule with params (
    ZOkYjmZ,
    Fee,
    46,
    47
)

I attempted to alter the order of the parameters and different options with no luck, any recommendation?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles