免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
iOS項(xiàng)目社會(huì)化分享-微信分享,朋友圈分享,ios朋友圈

iOS項(xiàng)目社會(huì)化分享-微信分享,朋友圈分享,ios朋友圈


我只做了文字和圖片分享功能


1. TARGETS - Info - URL Types 

identifier -> weixin

URL Schemes ->  應(yīng)用id


2.在A(yíng)ppDelegate.h 引入頭文件 

<pre name="code" class="objc">#import "WXApi.h"{/** *      WXSceneSession   分享到會(huì)話(huà) *      WXSceneTimeline  分享到朋友圈 *      WXSceneFavorite  分享到我的收藏 */    enum WXScene _scene;}

3.在A(yíng)ppDelegate.m

- (id)init{    if(self = [super init]){        _scene = WXSceneSession;    }    return self;}-(void) changeScene:(NSInteger)scene{    _scene = scene;}- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{	    // 其它代碼    // 向微信注冊(cè)應(yīng)用ID    [WXApi registerApp:@"xxooxoxoxoxoxoxo"];}#pragma mark - 重寫(xiě)AppDelegate的handleOpenURL和openURL方法- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{    return [WXApi handleOpenURL:url delegate:self];}- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{    return [WXApi handleOpenURL:url delegate:self];}
//<span style="font-family: Arial, Helvetica, sans-serif;">onReq 和 </span><span style="font-family: Arial, Helvetica, sans-serif;">onResp 可以不寫(xiě)</span><span style="font-family: Arial, Helvetica, sans-serif;"></span>-(void) onReq:(BaseReq*)req{    if([req isKindOfClass:[GetMessageFromWXReq class]])    {        // 微信請(qǐng)求App提供內(nèi)容, 需要app提供內(nèi)容后使用sendRsp返回        NSString *strTitle = [NSString stringWithFormat:@"微信請(qǐng)求App提供內(nèi)容"];        NSString *strMsg   = @"微信請(qǐng)求App提供內(nèi)容,App要調(diào)用sendResp:GetMessageFromWXResp返回給微信";                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:strTitle message:strMsg delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];        alert.tag = 1000;        [alert show];        [alert release];    }    else if([req isKindOfClass:[ShowMessageFromWXReq class]])    {        ShowMessageFromWXReq* temp = (ShowMessageFromWXReq*)req;        WXMediaMessage *msg = temp.message;                //顯示微信傳過(guò)來(lái)的內(nèi)容        WXAppExtendObject *obj = msg.mediaObject;                NSString *strTitle = [NSString stringWithFormat:@"微信請(qǐng)求App顯示內(nèi)容"];        NSString *strMsg   = [NSString stringWithFormat:@"標(biāo)題:%@ \n內(nèi)容:%@ \n附帶信息:%@ \n縮略圖:%u bytes\n\n", msg.title, msg.description, obj.extInfo, msg.thumbData.length];                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:strTitle message:strMsg delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];        [alert show];        [alert release];    }    else if([req isKindOfClass:[LaunchFromWXReq class]])    {        //從微信啟動(dòng)App        NSString *strTitle = [NSString stringWithFormat:@"從微信啟動(dòng)"];        NSString *strMsg   = @"這是從微信啟動(dòng)的消息";                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:strTitle message:strMsg delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];        [alert show];        [alert release];    }}-(void) onResp:(BaseResp*)resp{    if([resp isKindOfClass:[SendMessageToWXResp class]])    {        NSString *strTitle = [NSString stringWithFormat:@"發(fā)送媒體消息結(jié)果"];        NSString *strMsg = [NSString stringWithFormat:@"errcode:%d", resp.errCode];                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:strTitle message:strMsg delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];        [alert show];        [alert release];    }}




4.這是我寫(xiě)好的在微信會(huì)話(huà)和朋友圈分享文字或者圖片的方法

直接調(diào)用就可以


#pragma mark - 微信, 朋友圈分享#pragma mark 文字分享- (void)sharedByWeChatWithText:(NSString *)WeChatMessage sceneType:(int)sceneType{    SendMessageToWXReq *req = [[[SendMessageToWXReq alloc] init]autorelease];    req.text  = WeChatMessage;    req.bText = YES;    req.scene = sceneType;    [WXApi sendReq:req];}#pragma mark 圖片分享- (void)sharedByWeChatWithImage:(NSString *)imageName sceneType:(int)sceneType{    WXMediaMessage *message = [WXMediaMessage message];    [message setThumbImage:[UIImage imageNamed:imageName]];        WXImageObject *ext = [WXImageObject object];    NSString *filePath = [[NSBundle mainBundle] pathForResource:imageName ofType:@"png"];    ext.imageData  = [NSData dataWithContentsOfFile:filePath];    UIImage *image = [UIImage imageWithData:ext.imageData];    ext.imageData  = UIImagePNGRepresentation(image);        message.mediaObject = ext;        SendMessageToWXReq *req = [[[SendMessageToWXReq alloc] init]autorelease];    req.bText   = NO;    req.message = message;    req.scene   = sceneType;        [WXApi sendReq:req];}








對(duì)于社會(huì)化分享微信的問(wèn)題

別的可以自然代碼問(wèn)題不大,我想到一個(gè)可能的問(wèn)題,你試試運(yùn)行過(guò)去后拔掉USB線(xiàn),然后手機(jī)重新運(yùn)行應(yīng)用,原因是微信的sdk的debug下面有問(wèn)題。。。想當(dāng)初我唄困在這里好久好久,。。。
 

為何用吐槽神器與萌圖分享到微信朋友圈,發(fā)好了為何開(kāi)自己的朋友圈看不見(jiàn)?

我同樣是IOS6的系統(tǒng),分享到微信上的基本十次有九次都是看不到的;看上去好像是分享成功了,其實(shí)根本沒(méi)被接受。。。這是微信與IOS6之間的沖突問(wèn)題,上次我提問(wèn)給微信團(tuán)隊(duì),他們回復(fù)我說(shuō)暫時(shí)還有問(wèn)題,帶來(lái)不便十分抱歉。。。
 

原文地址:http://www.bkjia.com/Androidjc/904341.html

 
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶(hù)發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
iOS微信支付開(kāi)發(fā) | iOS開(kāi)發(fā)
基于第三方微信授權(quán)登錄的iOS代碼分析
iOS 微信分享 功能簡(jiǎn)單實(shí)現(xiàn)
iOS 微信分享 朋友圈
IOS 微信1.8.7對(duì)接以及Universal Links詳細(xì)說(shuō)明(微信未驗(yàn)證應(yīng)用解決辦法)
iOS 個(gè)推在獲得推送消息的時(shí)候如何實(shí)現(xiàn)跳轉(zhuǎn)到對(duì)應(yīng)頁(yè)面
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服