標籤: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 整合友盟分享