IOS 整合友盟分享

來源:互聯網
上載者:User

標籤:objects   delegate   void   回調   string   ota   nsarray   finish   nsurl   

#import <Foundation/Foundation.h>@interface UMSocialSinaHandler : NSObject+(void)openSSOWithRedirectURL:(NSString *)redirectURL;@end

 

#import "AppDelegate.h"#import "UMSocial.h"  #import "UMSocialSinaHandler.h"@interface AppDelegate ()@end@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    // Override point for customization after application launch.    // 設定友盟分享的秘鑰     [UMSocialData setAppKey:@"5458264dfd98c5b5c9007064"];        //開啟新浪微博的SSO開關,設定新浪微博回調地址,這裡必須要和你在新浪微博後台設定的回調地址一致。若在新浪後台設定我們的回調地址,“http://sns.whalecloud.com/sina2/callback”,這裡可以傳nil    [UMSocialSinaHandler openSSOWithRedirectURL:@"http://sns.whalecloud.com/sina2/callback"];        return YES;}- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{    return  [UMSocialSnsService handleOpenURL:url];}- (BOOL)application:(UIApplication *)application            openURL:(NSURL *)url  sourceApplication:(NSString *)sourceApplication         annotation:(id)annotation{    return  [UMSocialSnsService handleOpenURL:url];}@end

 

#import "ViewController.h"#import "UMSocial.h"@interface ViewController ()@end@implementation ViewController- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{    //注意:分享到好友、朋友圈、收藏、QQ空間、QQ好友、來往好友、來往朋友圈、易信好友、易信朋友圈、Facebook、Twitter、Instagram等平台需要參考各自的整合方法    /*     SheetView: 需要在哪個視圖中展示     appKey: 當前應用的友盟分享的key     shareText: 需要分享的文本     shareImage: 需要分享的圖片     shareToSnsNames: 需要分享到的平台     */    /*    [UMSocialSnsService presentSnsIconSheetView:self                                         appKey:@"5458264dfd98c5b5c9007064"                                      shareText:@"你要分享的文字"                                     shareImage:[UIImage imageNamed:@"icon.png"]                                shareToSnsNames:[NSArray arrayWithObjects:UMShareToSina,UMShareToTencent,UMShareToRenren, UMShareToDouban, UMShareToFacebook, UMShareToFlickr, UMShareToInstagram, nil]                                       delegate:nil];     */        [UMSocialSnsService presentSnsIconSheetView:self                                         appKey:@"5458264dfd98c5b5c9007064"                                      shareText:@"友盟社會化分享讓您快速實現分享等社會化功能,www.umeng.com/social"                                     shareImage:[UIImage imageNamed:@"icon.png"]                                shareToSnsNames:@[UMShareToSina]                                       delegate:self];}@end

 

 

IOS 整合友盟分享

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.