Step 1: The following framework needs to be introduced

// Need to introduce framework:  1. SystemConfiguration.framework 2. CoreGraphics.framework 3. libsqlite3.dylib 4. CoreTelephony.framework 5. libstdc++.dylib, 6. libz.dyliCopy the code

Step 2: download the latest SDK download the SDK link, http://dev.umeng.com/social/ios/sdk-download

// Drag the umsocial_sdK-x.x.x folder to the project directory and make sure Copy Items to destination is selectedThe 'Group Folder' option, And select the Target // libumsocial_sdk-x.x.x. a libumsocial_sdk_comment_3.0.a library file // Header text // SocialSDKXib xib file // Iproj, zh-Hans.Iproj English and Chinese language files // frameworks used by the third party SDK, inside the Wechat, TencentOperAPI, TencentWeiboSSO, respectively represent Wechat, mobile QQ and Tencent weibo SDKCopy the code

** note: ** as apple requires all applications to be IPv6 compatible before June, we need to update the SDK to version 5.2.1 to avoid being rejected for APPstore review!!

Step 3: Adapt to iOS9 As Apple has strengthened its security policy after iOS9, if you use XCode7 for integration and development and umENG SDK, you need to configure the following for adaptation to iOS9:

  • A, add the secure domain name whitelist in info.plist (right-click info.plist and use source code to open it). Add what you need according to the platform you need to share. For details, please refer to the official documentation link of UmU: http://dev.umeng.com/social/ios/ios9, don’t put the screenshots here too long
  • Add NSAllowsArbitraryLoads to info.plist NSAppTransportSecurity and set it to YES

Step 4: Configuration scheme URL http://dev.umeng.com/social/ios/quick-integration#1_4 in your project Settings, the column under the targets, select their own target, in the Info – > URL Types URL Schemes are added in. If you are using Xcode3 or lower, you need to add it in the PList file. The method of obtaining the appkey or APPID of each platform can be obtained by referring to the sharing details document binding to each platform part. The URL scheme format of each platform is shown in the following table:

** Step 5: ** Other precautions

  • 1. Add the -objc option in other Linker Flags and add ImageIO system framework for Sina Weibo sharing
  • 2. There must be pictures when sharing QQ space, otherwise sharing will fail

** Step 6: ** Implement as follows: 1. Use friends in AppDelegate:

- (BOOL) application: (UIApplication *) application didFinishLaunchingWithOptions: (launchOptions NSDictionary *) {/ / use their Allies [self useUMengSocialData];returnYES; } - (void)useUMengSocialData {// Set the UMSocialData AppKeysetAppKey:UMengAppKey]; // The first parameter is sina appkey, the second parameter is Sina secret, and the third parameter is Sina Weibo callback address, which must be the same as the callback address you set in the background of Sina Weibo. [UMSocialSinaSSOHandler openNewSinaSSOWithAppKey:WBShareAppKey secret:WBShareAppSecret RedirectURL:@"http://sns.whalecloud.com"]; // Set the wechat AppId and share URL. The default url is UMSocialWechatHandlersetWXAppId:WXAppID appSecret:WXShareAppSecret url:@"http://www.baidu.com"]; // Set the application Id to share to Qzone, and share url link [UMSocialQQHandler]setQQWithAppId:QQShareAppID appKey:QQShareAppKey url:@"http://www.baidu.com"]; } /** Here handle sina Weibo SSO authorization into sina Weibo client after entering the background, Returns to the original application * / - (void) applicationDidBecomeActive: (UIApplication *) application {[UMSocialSnsService applicationDidBecomeActive]; }Copy the code

2. Call the third party share from the controller:

#import "UMSocial.h"

#pragma mark - UMSocialUIDelegate- (void)shareBtnClick {// Share embedded text NSString *shareText = @"Test shared text"; UIImage *shareImage = [UIImage imageNamed:@"icon"]; / / share group order According to demand their corresponding modify NSArray * arr = [NSArray arrayWithObjects: UMShareToSina, UMShareToQQ, UMShareToQzone, UMShareToWechatSession, UMShareToWechatTimeline, nil]; // Customize title [UMSocialData defaultData].extconfig.qqdata.title = @"Test";
    [UMSocialData defaultData].extConfig.qzoneData.title = @"Test";
    [UMSocialData defaultData].extConfig.wechatSessionData.title = @"Test";
    [UMSocialData defaultData].extConfig.wechatTimelineData.title = @"Test"; // [UMSocialData defaultData].extconfig.qqdata.url = @"http://baidu.com"; / / call quick sharing interface [UMSocialSnsService presentSnsIconSheetView: self appKey: UMengAppKey shareText: shareText shareImage: shareImage  shareToSnsNames:arr delegate:self]; // The test SDK will see the corresponding error code after the console output. [UMSocialData openLog:YES]; } - (void) didFinishGetUMSocialDataInViewController response: (UMSocialResponseEntity *) {/ / according to ` responseCode ` get sent as a result, if share successifResponse.responsecode == UMSResponseCodeSuccess) {// Get the shared weibo platform name NSLog(@"share to sns name is %@",[[response.data allKeys] objectAtIndex:0]); }}Copy the code

3. Log in to the third-party controller

#pragma Mark - Third party logins 1. Complete authorization on third party platforms 2. Access to accesstoken information and user data from third-party platforms- (void)qqLoginClick { UMSocialSnsPlatform *snsPlatform = [UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToQQ]; snsPlatform.loginClickHandler(self,[UMSocialControllerService defaultControllerService],YES,^(UMSocialResponseEntity *response){// Get weibo user name, UID, token, etcif (response.responseCode == UMSResponseCodeSuccess) {
            
            UMSocialAccountEntity *snsAccount = [[UMSocialAccountManager socialAccountDictionary] valueForKey:UMShareToQQ];
            
            NSLog(@"username is %@, uid is %@, token is %@ url is %@",snsAccount.userName,snsAccount.usid,snsAccount.accessToken,snsAccount.iconURL);
            
        }});
}

- (void)wechatLoginClick {
    
    UMSocialSnsPlatform *snsPlatform = [UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToWechatSession];
    
    snsPlatform.loginClickHandler(self,[UMSocialControllerService defaultControllerService],YES,^(UMSocialResponseEntity *response){
        
        if (response.responseCode == UMSResponseCodeSuccess) {
            
            UMSocialAccountEntity *snsAccount = [[UMSocialAccountManager socialAccountDictionary]valueForKey:UMShareToWechatSession];
            
            NSLog(@"username is %@, uid is %@, token is %@ url is %@",snsAccount.userName,snsAccount.usid,snsAccount.accessToken,snsAccount.iconURL); }}); } - (void)weiboLoginClick { UMSocialSnsPlatform *snsPlatform = [UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToSina]; snsPlatform.loginClickHandler(self,[UMSocialControllerService defaultControllerService],YES,^(UMSocialResponseEntity *response){// Get weibo user name, UID, token, etcif (response.responseCode == UMSResponseCodeSuccess) {
            
            UMSocialAccountEntity *snsAccount = [[UMSocialAccountManager socialAccountDictionary] valueForKey:UMShareToSina];
            
            NSLog(@"username is %@, uid is %@, token is %@ url is %@",snsAccount.userName,snsAccount.usid,snsAccount.accessToken,snsAccount.iconURL);
            
    }});
}
Copy the code

Recently for iOS10 compatible write iOS10 friends share 6.0.3, has been updated to 6.8.0 version, there is a need to please go to: friends share 6.8.0