IOS 接ShareSDK问题
如果报错AGCommon 等错误
引用libicucore.A.dylib
ShareSDK 官网 管理中心 → 创建一个新的应用 获得key之后 啥都别做。!
- (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation { NSMutableArray* keys = [NSMutableArray arrayWithCapacity:3]; NSMutableArray* values = [NSMutableArray arrayWithCapacity:3]; #define ADD_ITEM(item) do{ if(item) {[keys addObject:@#item]; [values addObject:item];} }while(0) ADD_ITEM(url); ADD_ITEM(sourceApplication); ADD_ITEM(annotation); #undef ADD_ITEM NSDictionary* notifData = [NSDictionary dictionaryWithObjects:values forKeys:keys]; AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData); //return YES; return [ShareSDK handleOpenURL:url sourceApplication:sourceApplication annotation:annotation wxDelegate:self]; } - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { return [ShareSDK handleOpenURL:url wxDelegate:self]; }
打开AppController.mm文件,添加ShareSDK.h头文件:
#import <ShareSDK/ShareSDK.h>
新增handleOpenURL的处理方法,代码如下:
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
return [ShareSDK handleOpenURL:url wxDelegate:nil];
}
{
return [ShareSDK handleOpenURL:url wxDelegate:nil];
}
// 这个方法 AppController 默认有 所以把return 的那段代码 拷贝到后面就行。 红色部分改成 self
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [ShareSDK handleOpenURL:url sourceApplication:sourceApplication annotation:annotation wxDelegate:nil];
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [ShareSDK handleOpenURL:url sourceApplication:sourceApplication annotation:annotation wxDelegate:nil];
}