资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

ios开发微博分享,ios相册分享微博故事

ios应用如果没上线能不能申请微博和QQ分享接口?

可以。

成都创新互联主营椒江网站建设的网络公司,主营网站建设方案,成都APP应用开发,椒江h5成都微信小程序搭建,椒江网站营销推广欢迎椒江等地区企业咨询

这些在你程序开发阶段就要申请,拿到授权后,在开发相应的功能,完了还要测试OK才会上架。

这个申请只需要提供相应的资质文件证明就可以了。

iOS 开发新浪微博分享功能在模拟器上运行的时候为什么提示要安装最新版新浪微博?

ios官方SDK是XCode,但其必须安装在苹果系统Mac OS下,你除非有苹果电脑或者安装了苹果虚拟机才能使用XCode,进而开发运行ios应用程序。

ios sharesdk 新浪微博分享怎样拉起微博app

第一步:在targets-info-url types中添加一项,命名为wb+appid(到官网开放平台去申请)

第二步:写一个分享功能类

[objc] view plain copy print?

// 省略头文件

@interface HYBShareSDKHelper : NSObject

+ (void)registerShareSDK;

+ (BOOL)handleOpenURL:(NSURL *)url;

+ (BOOL)handleOpenURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;

// 调用此方法来分享信息

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

外部调用上面封装的方法来实现功能

[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];

// 添加新浪微博应用

NSString *redirectUri = @"";

// 添加新浪微博应用

[ShareSDK connectSinaWeiboWithAppKey:kSinaWeiboAppKey

appSecret:kSinaWeiboAppSecret

redirectUri:redirectUri];

// 当使用新浪微博客户端分享的时候需要按照下面的方法来初始化新浪的平台

[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 {

// 分享内容

idISSContent sharedContent = [ShareSDK content:content

defaultContent:content

image:[ShareSDK pngImageWithImage:pngImage]

title: title

url:url

description:@"自己看着办"

mediaType:mediaType];

// 验证参数

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:@"美容总监"

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:@"美容总监"

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

iOS 无新浪微博客户端时分享的问题

分享时,使用网页登陆后就出现 {"error":"userinfo error","pos":"5"} 这个错误信息

若是没有安装微博客户端,则使用网页登陆授权,进行分享。使用网页登陆后就出现{"error":"userinfo error","pos":"5"} 这个错误信息

在进行新浪微博分享的时候,最早在新浪微博开放中平台创建应用后,当是手机上没有安装新浪微博客户端时,进行分享时,如果没有添加测试账号的前提下在网页模式下分享内容到微博。就会出现这样的错误。

若是应用过审了,则任意微博账号都可以无阻的进行分享,但处于开发阶段,这个过审就是不可及的,所以就是添加测试账号。

添加测试账号方式:

在微博官方平台我的应用-应用右边:应用详情-左边:应用信息-高级信息-最下边:测试用户

ios开发分享到微博,怎么确定微博用户的授权状态?api里没有看到类似的接口

好吧,这个我也不知道,不过你可以去DevStore选一下,有源码下载


标题名称:ios开发微博分享,ios相册分享微博故事
文章源于:http://cdkjz.cn/article/dsciiei.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220