iOS微信分享开发
2015-01-04 10:37
387 查看
m文件
h文件
配置完全正确,但是就是不能启动微信客户端。
后来仔细看官网文档,才发现,发送的带图片的信息不能大于 10k 。操,压缩了图片,总算搞好了。
你中枪了吗,如果中枪的话,留个言吧
-(void)rightButtonClick:(UIButton *)aButton { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"分享到微信", @"分享到朋友圈",nil]; actionSheet.actionSheetStyle = UIActionSheetStyleAutomatic; [actionSheet showInView:self.view]; // // [actionSheet showInView:[[[[UIApplication sharedApplication] keyWindow] subviews] lastObject]]; } #pragma mark ---actionsheet delegate -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex == 0) { _scene = WXSceneSession; [_delegate changeScene:WXSceneSession]; [self sendAppExtendContent]; } else if (buttonIndex == 1) { _scene=WXSceneTimeline; [_delegate changeScene:WXSceneTimeline]; [self sendAppExtendContent_friend]; } else if(buttonIndex == 2) { } } - (void)actionSheetCancel:(UIActionSheet *)actionSheet { } - (void)sendAppExtendContent { if ([WXApi isWXAppInstalled] && [WXApi isWXAppSupportApi]) { WXMediaMessage *message = [WXMediaMessage message]; [message setThumbImage:[UIImage imageNamed:@"wxIcon.png"]]; message.title = [NSString stringWithFormat:@"大才校园招聘"]; message.description = [NSString stringWithFormat:@"%@",[[self.dic valueForKey:@"HiringInfo"] valueForKey:@"Description"]]; WXAppExtendObject *ext1 =[WXAppExtendObject object]; ext1.url=@"https://itunes.apple.com/us/app/dian-mei-dian/id830075611?ls=1&mt=8"; message.mediaObject=ext1; SendMessageToWXReq* req = [[SendMessageToWXReq alloc] init]; req.bText = NO; req.message = message; req.scene = _scene; NSLog(@"=====%d",req.scene); [WXApi sendReq:req]; } else { [[iToast makeText:@"你还没有安装微信,无法使用此功能。"] show]; } } -(void)onResp:(BaseResp *)resp { NSLog(@"%@",resp); NSLog(@"errStr %@",[resp errStr]); NSLog(@"errCode %d",[resp errCode]); NSLog(@"type %d",[resp type]); } - (void)sendAppExtendContent_friend { if ([WXApi isWXAppInstalled] && [WXApi isWXAppSupportApi]) { WXMediaMessage *message = [WXMediaMessage message]; message.title = @"大才校园招聘"; message.description = [NSString stringWithFormat:@"%@",[[self.dic valueForKey:@"HiringInfo"] valueForKey:@"Description"]];; [message setThumbImage:[UIImage imageNamed:@"wxIcon.png"]]; WXAppExtendObject *ext =[WXAppExtendObject object]; ext.url=@"https://itunes.apple.com/us/app/dian-mei-dian/id830075611?ls=1&mt=8"; message.mediaObject=ext; SendMessageToWXReq* req = [[SendMessageToWXReq alloc] init]; req.bText = NO; req.message = message; req.scene = _scene; [WXApi sendReq:req]; } else { [[iToast makeText:@"你还没有安装微信,无法使用此功能。"] show]; } } -(void)changeScene:(NSInteger)scene { _scene = scene; }
h文件
#import "YbaseViewController.h" #import "WXApi.h" #import "WXApiObject.h" @protocol sendMsgToWeChatViewDelegate <NSObject> - (void) sendAppExtendContent; - (void) changeScene:(NSInteger)scene; @end @interface JobDetailViewController : YbaseViewController<UIActionSheetDelegate,WXApiDelegate,sendMsgToWeChatViewDelegate> { enum WXScene _scene; } @property (nonatomic,strong) NSString * offerId; @property (nonatomic, assign) id<sendMsgToWeChatViewDelegate> delegate; @end
配置完全正确,但是就是不能启动微信客户端。
后来仔细看官网文档,才发现,发送的带图片的信息不能大于 10k 。操,压缩了图片,总算搞好了。
你中枪了吗,如果中枪的话,留个言吧
相关文章推荐
- iOS项目开发实战——使用ShareSDK进行QQ和微信分享
- 友盟分享打不开QQ,提示微信未安装,iOS应用开发
- 苹果开发 笔记(81)ios 调用微信分享链接
- iOS开发 - 微信之简单文本分享(集成官方SDK)
- iOS开发之第三方分享微信分享、朋友圈分享,史上最新最全
- iOS应用程序开发之应用间的跳转(用着微信等第三方分享登陆)
- iOS 开发 APP集成微信分享功能遇到的问题-2016-10月
- iOS开发笔记14:微博/微信登录与分享、微信/支付宝支付
- iOS开发-仿微信图片分享界面实现
- iOS开发 ios9.0后友盟第三方分享, qq微信找不到设备
- iOS开发 微信SDK的分享功能
- iOS开发微信分享图片32K限制解决方案
- 微信开发 url传参数 json 导致 ios 微信分享失败苹果手机sinature签名无效
- iOS开发之第三方分享微信分享、朋友圈分享,史上最新最全第三方分享微信方式实现、朋友圈方式实现
- iOS开发-仿微信图片分享界面实现
- iOS开发009 iOS快速简单集成微信QQ微博分享
- iOS开发-仿微信图片分享界面实现
- 微信小程序开发文档:移动应用支持小程序类型分享(iOS应用)
- iOS下做微信分享的开发
- ios开发学习-手势交互(Gesture)效果源码分享