handleOpenUrl && openUrl

接着上篇的自定义URL scheme   在挂起和回调app的时候又遇到了问题、如下:


handleOpenURL && openURL的不同


handleOpenURL是其它应用通过调用你

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
作者LiuYulei001,代码LYLShareManager。 简单封装友盟第三方平台分享功能; 首先下载友盟分享功能的SDK,并注册相关AppKey及第三方平台的AppKey; 然后按照友盟官网配置下工程,之后再使用此类; // 首先:配置第三方平台URL Scheme ->1->2->3->4 /** 1.打开日志 @param isOpen YES代表打开,No代表关闭 */ +(void)openLog:(BOOL)isOpen; /** 2.设置友盟AppKey @param UmSocialAppkey 友盟AppKey */ +(void)setUmSocialAppkey:(NSString *)UmSocialAppkey; /** 3.设置平台的appkey @param platform 平台类型 @see UMSocialPlatformType @param appKey 第三方平台的appKey(QQ平台为appID) @param appSecret 第三方平台的appSecret(QQ平台为appKey) @param redirectURL redirectURL */ +(BOOL)setPlatform:(UMSocialPlatformType)platform appKey:(NSString *)appKey appSecret:(NSString *)appSecret redirectURL:(NSString *)redirectURL; /** 4.获得从sso或者web端回调到本app的回调 << - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(id)annotation >> @param URL 第三方sdk的打开本app的回调的url @return 是否处理 YES代表处理成功,NO代表不处理 */ +(BOOL)handleOpenURL:(NSURL *)URL; // 分享功能(适用自定义分享UI页面) /** 图文分享 @param platformType 平台类型 @see UMSocialPlatformType @param ContentText 文本(纯图可以为nil) @param thumbnail 缩略图 @param shareImage 分享图片 */ +(void)shareGraphicToPlatformType:(UMSocialPlatformType)platformType ContentText:(NSString *)ContentText thumbnail:(id)thumbnail shareImage:(id)shareImage success:(success)success failure:(failure)failure; /** 多媒体分享 @param platformType 平台类型 @see UMSocialPlatformType @param ShareContentType 分享多媒体类型 @see ShareContentType @param title 标题 @param contentDescription 分享描述 @param thumbnail 缩略图 @param url 内容网页地址 @param StreamUrl 数据流地址 */ +(void)shareMultimediaToPlatformType:(UMSocialPlatformType)platformType ShareContentType:(ShareContentType)ShareContentType title:(NSString *)title contentDescription:(NSString *)contentDescription thumbnail:(id)thumbnail url:(NSString *)url StreamUrl:(NSString *)StreamUrl success:(success)success failure:(failure)failure;
CCOpenServiceLite 是CC轻量级开放平台服务,统一入口,一行代码获取微信,QQ,微博等帐号信息,分享,收藏等功能。目前市面上提供的第三方SDK,相当繁琐臃肿,还需要去他们的集成平台上注册各种key之类的,相当麻烦.CC轻量级开放平台服务提供一行代码请求数据服务,底层集成了各平台SDK,用户无需关心具体平台的实现,省事省心.主要功能集成微信,QQ,微博的开放平台SDK.提供统一的请求入口,一句代码即可完成任务,简单高效.目前支持开放平台登录接入功能,其他功能(分享,收藏,评论等)后期有时间会更新上.使用方法1 直接将整个目录拖到你的项目中.(注意用group形式,目录会显示成黄色).本库用到AFNetworking,需要自己集成.2 在AppDelegate.m文件顶部引入头文件CCOpenService.h,CCOpenConfig.h,并且写入下面的配置信息(注意,类似WeiXinAppID这样的,填写自己的微信appID)//AppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {     //微信配置     [CCOpenConfig setWeiXinAppID:WeiXinAppID];     [CCOpenConfig setWeiXinAppSecret:WeiXinAppSecret];     //QQ配置     [CCOpenConfig setQQAppID:QQAppID];     [CCOpenConfig setQQAppKey:QQAppKey];     //微博配置     [CCOpenConfig setWeiBoAppKey:WeiBoAppKey];     [CCOpenConfig setWeiBoAppSecret:WeiBoAppSecret];     [CCOpenConfig setWeiBoRedirectURI:WeiBoRedirectURI];     return YES; } -(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{     //配置微信,QQ,新浪     CCOpenService *wxService = [CCOpenService getOpenServiceWithName:CCOpenServiceNameWeiXin];     CCOpenService *qqService = [CCOpenService getOpenServiceWithName:CCOpenServiceNameQQ];     CCOpenService *wbService = [CCOpenService getOpenServiceWithName:CCOpenServiceNameWeiBo];     return [wxService handleOpenURL:url] || [qqService handleOpenURL:url] || [wbService handleOpenURL:url]; } -(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{     //配置微信,QQ,新浪     CCOpenService *wxService = [CCOpenService getOpenServiceWithName:CCOpenServiceNameWeiXin];     CCOpenService *qqService = [CCOpenService getOpenServiceWithName:CCOpenServiceNameQQ];     CCOpenService *wbService = [CCOpenService getOpenServiceWithName:CCOpenServiceNameWeiBo];     return [wxService handleOpenURL:url] || [qqService handleOpenURL:url] || [wbService handleOpenURL:url]; }3 参考各个平台关于URL scheme的配置指南.例如微信: 4 iOS9 设备需要添加白名单,参考iOS9白名单接口使用说明  服务类型目前支持CCOpenServiceNameWeiXin,CCOpenServiceNameQQ,CCOpenServiceNameWeiBo第三方登录接口//微信登录 CCOpenService *wxService = [CCOpenService getOpenServiceWithName:CCOpenServiceNameWeiXin]; [wxService requestOpenAccount:^(CCOpenRespondEntity *respond) {     if (respond == nil) {         UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:@"^_^亲,您木有安装微信哟~ " delegate:nil cancelButtonTitle:@"知道啦" otherButtonTitles:nil];         [alert show];         return;     }     NSLog(@"Respond data is %@",respond.data); }];其他说明  WeiXin,QQ,WeiBo目录下的SDK需要手动导入,另外第三方平台的SDK可能需要手动导入一些类库,具体的先参考具体平台的官方说明,有空更新上.   由于本人工作忙,所以很多功能还没时间写上.目前已经写好了整体框架,有兴趣的同学可当作自己学习锻炼机会,参考我的源码设计模式,将新增的功能PullRrequest给我,谢谢. 标签:微服务框架

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值