Joke Collection Website - Public benefit messages - ios友盟分享 新浪微博怎么是网络视图
ios友盟分享 新浪微博怎么是网络视图
友盟开发者平台官网 友盟集成文档
友盟软件开发工具包下载地址友盟软件开发工具包下载地址
2,成功下载软件开发工具包集成后,微信分享需要配置一下
新浪微博 之类到同样配置就行
3。整合完之后就开始上代码了
ShareManage.h
[objc]查看纯文本
//
// ShareManage.h
//康佳_MARKET
//
//由wxxu于14/12/18创建。//版权所有(c) 214年执政官版权所有
//分享管理
//友盟API key
# define UMeng _ API key @ " "//友盟appKey
#define WX应用密钥@""//微信appId
#define WX应用程序秘密@""//微信app secret
# define share _ title @ " "//分享标题
#define share_content @""//分享内容
#define share_url @""//分享url
# import & ltfoundation/foundation . h & gt;#导入& ltmessage ui/message ui . h & gt;@ interface share manage:ns object & lt;MFMessageComposeViewControllerDelegate & gt;+(share manage *)share manage;-(void)share config;/**微信分享* */
-(void)wxsharewithviewcontrol:(UIViewController *)viewC;/**新浪微博分享* */-(void)wbShareWithViewControll:(UIViewController *)viewC;/**微信朋友圈分享* */-(void)wxpyqsharewithviewcontrol:(uiview controller *)viewC;/**短信分享* */-(void)smssharewithviewcontrol:(uiview controller *)viewC;@end
ShareManage.m
[objc]查看纯文本
//
// ShareManage.m
//康佳_MARKET
//
//由wxxu于14/12/18创建。//版权所有(c) 214年执政官版权所有
//分享管理
# import " share manage . h "
# import " um social . h "
# import " umsocialwechathandler . h "
# import " wx API . h "
@ implementation share manage {
UIViewController * _ viewC;}
静态ShareManage * shareManage+(share manage *)share manage
{
@ synchronized(self)
{
if(share manage = = nil){
share manage =[[self alloc]init];}
返回shareManagep > }
}
#杂注标记注册友盟分享微信- (void)shareConfig设置友盟社会化组件appkey
[UMSocialData setAppKey:UMeng _ API key];
[UMSocialData openLog:是];
//注册微信
[WXApi register APP:WX _ APP _ KEY];
//设置图文分享
[UMSocialData default data]. extconfig . wxmessagetype = UMSocialWXMessageTypeWeb;}
#杂注标记微信分享
-(void)wxShareWithViewControll:(UIViewController *)viewC
{
_ viewC = viewC;
[[UMSocialControllerService defaultControllerService]setShareText:share _ content share image:nil social uidelegate:nil];
[UMSocialWechatHandler setWXAppId:WX _ APP _ KEY APP SECRET:WX _ APP _ SECRET URL:share _ URL];
[UMSocialSnsPlatformManager getSocialPlatformWithName:umsharetowhatession]。snsClickHandler(viewC,[UMSocialControllerService defaultControllerService],YES);}
#杂注标记新浪微博分享-(void)wbShareWithViewControll:(UIViewController *)viewC
{
_ viewC = viewC;
[[UMSocialControllerService defaultControllerService]setShareText:share _ content share image:nil social uidelegate:nil];
[UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToSina]。snsClickHandler(viewC,[UMSocialControllerService defaultControllerService],YES);}
#杂注标记微信朋友圈分享-(void)wxpyqShareWithViewControll:(UIViewController *)viewC
{
_ viewC = viewC;
[[UMSocialControllerService defaultControllerService]setShareText:share _ content share image:nil social uidelegate:nil];
[UMSocialWechatHandler setWXAppId:WX _ APP _ KEY APP SECRET:WX _ APP _ SECRET URL:share _ URL];
[UMSocialSnsPlatformManager getSocialPlatformWithName:umsharetowhatctimeline]。snsClickHandler(viewC,[UMSocialControllerService defaultControllerService],YES);}
#杂注标记短信分享-(void)smsShareWithViewControll:(UIViewController *)viewC
{
_ viewC = viewC;
Class message Class =(NSClassFromString(@ " MFMessageComposeViewController));
if (messageClass!= nil){
if([message class canSendText]){
[self displaysmscoposersheet];}
else {
//@ "设备没有短信功能"
}
}
else {
//@"iOS版本过低,iOS4.以上才支持程序内发送短信"
}
}
#杂注标记短信的代理方法
-(void)messageComposeViewController:(MFMessageComposeViewController *)controller difinishwithresult:(MessageComposeResult)result {
[_ viewC dismissViewControllerAnimated:YES completion:nil];switch(result)
{
casemessagecomposeresultcancelled:
break;
case MessageComposeResultSent:
//@ "感谢您的分享!"
breakcasemessagecomposeresultfailed:
break;
默认值:
break}
}
-(void)displaysmscoposersheet
{
MFMessageComposeViewController * picker =[[MFMessageComposeViewController alloc]init];
picker . messagecomposedelegate = self;
picker . navigation bar . tint color =[ui color black color];
//picker . recipients =[NSArray array with object:@ " 186 "];
picker.body = share _ content
[_ viewC present view controller:picker animated:YES completi
- Related articles
- Is 0775-2670868 a fraudulent phone call?
- Is the communication between Xinhua Life Insurance and the letter true?
- Can I pay back the money with Alipay for the 360 credit wallet?
- How to deal with the hotel recruitment interview?
- Loans overdue, what if the other party doesn't pay back the money?
- Detective just canceled. Do you want to log in with a verification code?
- 40 excellent sentence templates for welcoming new employees [sharing]
- How to give the Mid-Autumn Festival blessing to the class in groups?
- How to write a notice for a housewarming invitation?
- Zunyi epidemic prevention and control policy consultation telephone (Zunyi epidemic prevention and control leading group office telephone)