1.到官方平台下载ShareSDK,并将SDK导入到工程目录下
2.在build phases中导入相关的库
这些库的内容可以根据自己需求添加
3.再到平台申请该APP所用到的Key:registerApp
4.这一点,也是最容易忘掉的一点,需要到build setting ——>other linker ——>-ObjC
5.接下来info.plist的配置
在到info.plist的LSApplicationQueriesSchemes添加一个item 内容为weixin
5.就是粘代码
[ShareSDKregisterApp:@"输入平台你申请的Key"
activePlatforms:@[@(SSDKPlatformTypeSinaWeibo),
@(SSDKPlatformTypeWechat),]
onImport:^(SSDKPlatformType platformType) {
switch (platformType) {
case SSDKPlatformTypeWechat:
[ShareSDKConnectorconnectWeChat:[WXApi class]];
break;
case SSDKPlatformTypeSinaWeibo:
[ShareSDKConnectorconnectWeibo:[WeiboSDKclass]];
break;
default:
break;
}
}
onConfiguration:^(SSDKPlatformType platformType,NSMutableDictionary *appInfo) {
switch (platformType) {
case SSDKPlatformTypeSinaWeibo:
//设置新浪微博应用信息,其中authType设置为使用SSO+Web形式授权
[appInfo SSDKSetupSinaWeiboByAppKey:@"568898243" appSecret:@"38a4f8204cc784f81f9f0daaf31e02e3"
redirectUri:@"http://www.sharesdk.cn"
authType:SSDKAuthTypeBoth];
break;
case SSDKPlatformTypeWechat:
[appInfo SSDKSetupWeChatByAppId:@"wxb4ba3c02aa476ea1"//wxb4ba3c02aa476ea1 wx4868b35061f87885
appSecret:@"64020361b8ec4c99936c0e3999a9f249"];
break;
default:
break;
}
}];