検索

ホームページ  >  に質問  >  本文

ios - 自定义module添加category,导致部分method无法export

自定义module,给module添加7个category,部分method能够通过WX_EXPORT_METHOD暴露出来,然后其中会有一到两个无法暴露,同一个category中WX_EXPORT_METHOD4个以上的method,只会有两个成功,剩下两个失败。一下是其中一个category:

#import "plusModule+phoneCall.h"

static NSString *phoneNumberKey = @"number";

@implementation plusModule (phoneCall)

WX_EXPORT_METHOD(@selector(phoneCall::))

- (void)phoneCall:(NSString *)info :(WXModuleCallback)callBack {
    
    NSDictionary *dic = [ManageTheJSTransmit manageTheJSTransmitInfo:info];
    
    NSString *phoneNumber = [dic objectForKey:phoneNumberKey];
    if (phoneNumber.length <= 0) {
        [AssemblyTheCallBack assemblyTheCallBackWithTheOperationState:theOperationStateFailure data:nil message:@"未知号码" callBack:callBack];
        return;
    }
    
    NSMutableString *url = [[NSMutableString alloc] initWithFormat:@"telprompt://%@",phoneNumber];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
    
}

该方法在plusModule的一个category上,export失败,错误信息如下:
<Weex>[error]WXMonitor.m:196, [undefined:300:22] TypeError: plus.phoneCall is not a function. (In 'plus.phoneCall('{"number":"023-63517387"}')', 'plus.phoneCall' is undefined)
callPhone
main.js:3:10685
[native code]
main.js:4:497
forEach@[native code]
Ft@main.js:4:391
main.js:7:1153 ^[[;

xcode warning:

ld: warning: meta method 'wx_export_method_15' in category from /Users/ztq/Library/Developer/Xcode/DerivedData/JiafaStaff-hcjxgijxgruwpbdzwvdthjqvtzwh/Build/Intermediates/JiafaStaff.build/Debug-iphoneos/JiafaStaff.build/Objects-normal/arm64/plusModule+phoneCall.o conflicts with same method from another category

但是部分报相同警告的category能够通过WX_EXPORT_METHOD暴露出来

xcode 版本:8.3
weex 版本:0.10.3

大家讲道理大家讲道理2772日前588

全員に返信(0)返信します

応答なし
  • キャンセル返事