问题:当集成信鸽推送后,编译代码通过,可是链接时会报错,错误如下:
Seetong_tps(1063,0x1b4b58b40) malloc: protecting edges
2018-09-10 16:29:58.947898+0800 Seetong_tps[1063:1075476] [DYMTLInitPlatform] platform initialization successful
2018-09-10 16:29:59.263421+0800 Seetong_tps[1063:1075287] [Crashlytics] Version 3.8.3 (120)
2018-09-10 16:29:59.296799+0800 Seetong_tps[1063:1075287] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2018-09-10 16:29:59.298202+0800 Seetong_tps[1063:1075287] [MC] Reading from public effective user settings.
2018-09-10 16:29:59.316482+0800 Seetong_tps[1063:1075287] app_version=5.9.8
2018-09-10 16:29:59.392869+0800 Seetong_tps[1063:1075287] +[NSObject checkTargetOtherLinkFlagForObjc]: unrecognized selector sent to class 0x1b4b50ea0
2018-09-10 16:29:59.419172+0800 Seetong_tps[1063:1075287] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSObject checkTargetOtherLinkFlagForObjc]: unrecognized selector sent to class 0x1b4b50ea0'
*** First throw call stack:
(0x1827e2d8c 0x18199c5ec 0x1827effd8 0x1827e85c8 0x1826ce41c 0x10124e198 0x100ad39dc 0x100ad2f54 0x18c3eedbc 0x18c3ee1c4 0x18c3bb5e0 0x18c9ebb1c 0x18c3badd0 0x18c3bac6c 0x18c3b9afc 0x18d04f84c 0x18c3b91ec 0x18ce34ac8 0x18cf82bf8 0x18c3b8c0c 0x18c3b85a8 0x18c3b55e0 0x18c3b5330 0x184fe3470 0x184febd6c 0x102bc919c 0x102bd57cc 0x185017878 0x18501751c 0x185017ab8 0x18278b404 0x18278ac2c 0x18278879c 0x1826a8da8 0x18468d020 0x18c6c5758 0x100d7ac28 0x182139fc0)
libc++abi.dylib: terminating with uncaught exception of type NSException
找不到方法
'NSInvalidArgumentException', reason: '+[NSObject checkTargetOtherLinkFlagForObjc]: unrecognized selector sent to class 0x1b4b50ea0'
信鸽Demo和网上给出的方式是在配置文件Other Linker Flags中加入-ObjC, 我也尝试这样做。但是其他问题又来了。
当你集成了其他很多第三方库时,这种方法很不适用,会产生多个库文件冲突,有时几十上百个冲突,让你瞬间有种想死的感觉。
经过我多方验证,终于找到了不用-ObjC的方法,只要加入-force_load "(SRCROOT)/ThridFrameworks/WechtSDK1.8.2_NoPay/libWeChatSDK.a"
这里需要注意的是,"$(SRCROOT)/ThridFrameworks/XG_SDK/libXG-SDK.a"一定要放到前面,我之前就是这两个位置反了一直报错,后来尝试换了位置就OK了。然后正常编译过,没提示找不到方法和库冲突了。
希望大家在选择推送时考虑激光推送,不要选择信鸽推送,毕竟免费的总会有点毛病。