好吧,這個(gè)我也不知道,不過(guò)你可以去DevStore選一下,有源碼下載

路橋網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)建站!從網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、自適應(yīng)網(wǎng)站建設(shè)等網(wǎng)站項(xiàng)目制作,到程序開發(fā),運(yùn)營(yíng)維護(hù)。創(chuàng)新互聯(lián)建站成立與2013年到現(xiàn)在10年的時(shí)間,我們擁有了豐富的建站經(jīng)驗(yàn)和運(yùn)維經(jīng)驗(yàn),來(lái)保證我們的工作的順利進(jìn)行。專注于網(wǎng)站建設(shè)就選創(chuàng)新互聯(lián)建站。
第一步:在targets-info-url types中添加一項(xiàng),命名為wb+appid(到官網(wǎng)開放平臺(tái)去申請(qǐng))
第二步:寫一個(gè)分享功能類
[objc] view plain copy print?
// 省略頭文件
@interface HYBShareSDKHelper : NSObject
+ (void)registerShareSDK;
+ (BOOL)handleOpenURL:(NSURL *)url;
+ (BOOL)handleOpenURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;
// 調(diào)用此方法來(lái)分享信息
typedef void (^HYBShareCompletion)(BOOL successful);
+ (void)shareWithContent:(NSString *)content
toController:(UIViewController *)controller
pngImage:(UIImage *)pngImage
title:(NSString *)title
url:(NSString *)url
mediaType:(SSPublishContentMediaType)mediaType
shareViewDelegate:(idISSShareViewDelegate)shareViewDelegate
completion:(HYBShareCompletion)completion;
@end
外部調(diào)用上面封裝的方法來(lái)實(shí)現(xiàn)功能
[objc] view plain copy print?
//
// HYBShareSDKHelper.m
// CustomSharedSDKDemo
//
#import "HYBShareSDKHelper.h"
#import "HYBAppCommonInfoTool.h"
#import "HYBShareView.h"
#define kShareSDKAppKey @""
#define kShareSDKAppSecret @""
#define kSinaWeiboAppKey @""
#define kSinaWeiboAppSecret @""
@implementation HYBShareSDKHelper
+ (void)registerShareSDK {
[ShareSDK registerApp:kShareSDKAppKey];
// 添加新浪微博應(yīng)用
NSString *redirectUri = @"";
// 添加新浪微博應(yīng)用
[ShareSDK connectSinaWeiboWithAppKey:kSinaWeiboAppKey
appSecret:kSinaWeiboAppSecret
redirectUri:redirectUri];
// 當(dāng)使用新浪微博客戶端分享的時(shí)候需要按照下面的方法來(lái)初始化新浪的平臺(tái)
[ShareSDK connectSinaWeiboWithAppKey:kSinaWeiboAppKey
appSecret:kSinaWeiboAppSecret
redirectUri:redirectUri
weiboSDKCls:[WeiboSDK class]];
return;
}
+ (BOOL)handleOpenURL:(NSURL *)url {
return [ShareSDK handleOpenURL:url wxDelegate:self];
}
+ (BOOL)handleOpenURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [ShareSDK handleOpenURL:url sourceApplication:sourceApplication annotation:annotation wxDelegate:self];
}
// 這里是自己定制的彈出分享UI
+ (void)showShareViewInController:(UIViewController *)controller completion:(HYBShareClickBlock)completion {
HYBShareView *sv = [[HYBShareView alloc] initWithImages:@[@"sns_wx_icon", @"sns_wx_fr_icon", @"sns_qq_icon", @"sns_qzone_icon", @"sns_sina_icon"] titles:@[@"微信好友", @"微信朋友圈", @"QQ好友", @"QQ空間", @"新浪微博"] completion:^(NSUInteger index) {
if (completion) {
completion(index);
}
}];
[sv showInController:controller];
}
+ (void)shareWithContent:(NSString *)content
toController:(UIViewController *)controller
pngImage:(UIImage *)pngImage
title:(NSString *)title
url:(NSString *)url
mediaType:(SSPublishContentMediaType)mediaType
shareViewDelegate:(idISSShareViewDelegate)shareViewDelegate
completion:(HYBShareCompletion)completion {
// 分享內(nèi)容
idISSContent sharedContent = [ShareSDK content:content
defaultContent:content
image:[ShareSDK pngImageWithImage:pngImage]
title: title
url:url
description:@"自己看著辦"
mediaType:mediaType];
// 驗(yàn)證參數(shù)
idISSAuthOptions authOptions = [ShareSDK authOptionsWithAutoAuth:YES
allowCallback:YES
authViewStyle:SSAuthViewStyleFullScreenPopup
viewDelegate:nil
authManagerViewDelegate:nil];
// 顯示分享列表
[self showShareViewInController:controller completion:^(NSUInteger index) {
if (index == 4) {// 新浪微博
[self shareToSinaWeiboWithContent:sharedContent authOptions:authOptions content:content pngImage:pngImage completion:^(BOOL successful) {
if (completion) {
completion(successful);
}
}];
}
}];
}
// 分享到Sina weibo
+ (void)shareToSinaWeiboWithContent:(idISSContent)sharedContent
authOptions:(idISSAuthOptions)authOptions
content:(NSString *)content
pngImage:(UIImage *)pngImage
completion:(HYBShareCompletion)completion {
[sharedContent addSinaWeiboUnitWithContent:content
image:[ShareSDK pngImageWithImage:pngImage]];
// if haven authorized, then call
if (![ShareSDK hasAuthorizedWithType:ShareTypeSinaWeibo]) {
[ShareSDK authWithType:ShareTypeSinaWeibo options:authOptions result:^(SSAuthState state, idICMErrorInfo error) {
if (state == SSAuthStateSuccess) {
idISSShareOptions shareOptions = [ShareSDK simpleShareOptionsWithTitle:@"美容總監(jiān)"
shareViewDelegate:nil];
[ShareSDK clientShareContent:sharedContent
type:ShareTypeSinaWeibo
authOptions:authOptions
shareOptions:shareOptions
statusBarTips:YES
result:^(ShareType type, SSResponseState state, idISSPlatformShareInfo statusInfo, idICMErrorInfo error, BOOL end) {
if (completion end) {
DDLogVerbose(@"%@", error.errorDescription);
completion(state == SSPublishContentStateSuccess);
}
}];
}
}];
} else {// use client share to Sina App Client
idISSShareOptions shareOptions = [ShareSDK simpleShareOptionsWithTitle:@"美容總監(jiān)"
shareViewDelegate:nil];
[ShareSDK clientShareContent:sharedContent
type:ShareTypeSinaWeibo
authOptions:authOptions
shareOptions:shareOptions
statusBarTips:YES
result:^(ShareType type, SSResponseState state, idISSPlatformShareInfo statusInfo, idICMErrorInfo error, BOOL end) {
if (completion end) {
DDLogVerbose(@"%@", error.errorDescription);
completion(state == SSPublishContentStateSuccess);
}
}];
}
}
@end
您好,使用iOS6系統(tǒng),您可以將iPhone中的照片、Safari網(wǎng)頁(yè)、GameCenter數(shù)據(jù)分享到新浪微博。
分享時(shí),使用網(wǎng)頁(yè)登陸后就出現(xiàn) {"error":"userinfo error","pos":"5"} 這個(gè)錯(cuò)誤信息
若是沒(méi)有安裝微博客戶端,則使用網(wǎng)頁(yè)登陸授權(quán),進(jìn)行分享。使用網(wǎng)頁(yè)登陸后就出現(xiàn){"error":"userinfo error","pos":"5"} 這個(gè)錯(cuò)誤信息
在進(jìn)行新浪微博分享的時(shí)候,最早在新浪微博開放中平臺(tái)創(chuàng)建應(yīng)用后,當(dāng)是手機(jī)上沒(méi)有安裝新浪微博客戶端時(shí),進(jìn)行分享時(shí),如果沒(méi)有添加測(cè)試賬號(hào)的前提下在網(wǎng)頁(yè)模式下分享內(nèi)容到微博。就會(huì)出現(xiàn)這樣的錯(cuò)誤。
若是應(yīng)用過(guò)審了,則任意微博賬號(hào)都可以無(wú)阻的進(jìn)行分享,但處于開發(fā)階段,這個(gè)過(guò)審就是不可及的,所以就是添加測(cè)試賬號(hào)。
添加測(cè)試賬號(hào)方式:
在微博官方平臺(tái)我的應(yīng)用-應(yīng)用右邊:應(yīng)用詳情-左邊:應(yīng)用信息-高級(jí)信息-最下邊:測(cè)試用戶
可以用shareSDK
也可以用友盟分享
以上兩種形式都能夠?qū)崿F(xiàn)分享功能
新聞標(biāo)題:ios開發(fā)分享到微博,ios的share微博
網(wǎng)頁(yè)地址:http://chinadenli.net/article43/dseichs.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、動(dòng)態(tài)網(wǎng)站、虛擬主機(jī)、電子商務(wù)、網(wǎng)站排名、小程序開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)