cocos2dx ios 接入微信登录失败

一、微信注册失败

     点击打开链接

    微信注册[WeiboSDK registerApp: @"xxxxxxxx"]该放在哪?

放在AppController的didFinishLaunchingWithOptions里会出现类似错误:

[__NSDictionaryM weibosdk_WBSDKJSONString] : unrecognized selector sent to instance 0x170255780

二、解决问题遇到的阻碍

网上解决办法一:
在工程中引入静态库之后,需要在编译时添加   –ObjC   编译选项,避免静态库中类 加载   不全造成程序崩溃。方法:程序   Target->Buid   Settings->Linking   下   Other   Linker  Flags   项添加-ObjC
网上解决办法二:
在编译时添加  -all_load  编译选项时也可以解决问题。方法也是在   Target->Buid   Settings->Linking   下   Other   Linker  Flags   项添加 -all_load
微信Demo里是-Objc和-all_load,但我的cocos2d-x 项目如上添加之后会出现以下错误:
	Undefined symbols for architecture i386:
  	"_GCControllerDidConnectNotification", referenced from:
        	-[GCControllerConnectionEventHandler observerConnection:disconnection:] in libcocos2dx 		iOS.a(CCController-iOS.o)
  "_GCControllerDidDisconnectNotification", referenced from:
      -[GCControllerConnectionEventHandler observerConnection:disconnection:] in libcocos2dx iOS.a(CCController-iOS.o)
  "_OBJC_CLASS_$_GCController", referenced from:
      objc-class-ref in libcocos2dx iOS.a(CCController-iOS.o)
     (maybe you meant: _OBJC_CLASS_$_GCControllerConnectionEventHandler)
三、 正确的解决办法

这里先给出正确的解决办法再谈谈为什么要这么做。正确的做法还是设置 Other Linker Flags 这个编译选项,只不过即不用用-ObjC也不能用-all_load,而是要用-force_load path/to/your/libWeiboSDK.a,后面跟的是新浪微博 SDK 静态链接库的确切位置。


四、原因

链接地址:http://blog.csdn.net/yqmfly/article/details/45148081


  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值