ios - 自定义module添加category,导致部分method无法export
大家讲道理
大家讲道理 2017-04-18 09:57:07
[iOS讨论组]

自定义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

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

全部回复(0)
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号