iOS shareSDK 微博分享,sso认证怎么去掉
在APP中
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 方法中
连接新浪微博开放平台应用以使用相关功能,此应用需要引用SinaWeiboConnection.framework
http://open.weibo.com上注册新浪微博开放平台应用,并将相关信息填写到以下字段
**/
[ShareSDK connectSinaWeiboWithAppKey:SINA_WEIBO_APP_KEY
appSecret:SINA_WEIBO_APP_SECRET
redirectUri:SINA_WEIBO_APP_REDIRECT_URL
];
已经注册成功了,在分享的页面里的实现
id <ISSCAttachment> shopImage = [_shopModel.shopImg isEqualToString:@""] ? [ShareSDK imageWithPath:[[NSBundle mainBundle] pathForResource:@"Images.xcassets/LogoResources/about_logo_view_bg" ofType:@"png"]] : [ShareSDK imageWithUrl:[Public mosaicString:_shopModel.shopImg]];
NSString *shopName = [_shopModel.shopNm isEqualToString:@""] ? @"安e帮商铺分享" : _shopModel.shopNm;
NSString *shopDesc = [_shopModel.shopDesc isEqualToString:@""] ? @"商铺描述 : 无" : _shopModel.shopDesc;
NSString *shopUrl = HOUST_ARROUNDING_SHOP_SHARE_URL(self.shopSeno, [User shareInstance].userSeno);
//构造分享内容
id<ISSContent> publishContent = [ShareSDK content:@"安e帮分享 : "
defaultContent:shopDesc
image:nil
title:shopName
url:nil
description:@"微信分享内容2"
mediaType:SSPublishContentMediaTypeNews];
//以下信息为特定平台需要定义分享内容,如果不需要可省略下面的添加方法
[publishContent addSinaWeiboUnitWithContent:nil image:shopImage];
// //定制微信好友信息
[publishContent addWeixinSessionUnitWithType:[NSNumber numberWithInteger:SSPublishContentMediaTypeNews]
content:shopDesc
title:shopName
url:shopUrl
thumbImage:nil
image:shopImage
musicFileUrl:nil
extInfo:nil
fileData:nil
emoticonData:nil];
// //定制微信朋友圈信息
[publishContent addWeixinTimelineUnitWithType:[NSNumber numberWithInteger:SSPublishContentMediaTypeNews]
content:shopDesc
title:shopName
url:shopUrl
thumbImage:nil
image:shopImage
musicFileUrl:nil
extInfo:nil
fileData:nil
emoticonData:nil];
//定制QQ分享信息
[publishContent addQQUnitWithType:[NSNumber numberWithInteger:SSPublishContentMediaTypeNews]
content:shopDesc
title:shopName
url:shopUrl
image:shopImage];
//创建弹出菜单容器
id<ISSContainer> container = [ShareSDK container];
// id<ISSAuthOptions> authOptions = [ShareSDK authOptionsWithAutoAuth:YES
// allowCallback:YES
// authViewStyle:SSAuthViewStyleFullScreenPopup
// viewDelegate:nil
// authManagerViewDelegate:nil];
//
//// id<ISSAuthOptions> setFollowAccounts = [ShareSDK authOptionsWithAutoAuth:YES
//// allowCallback:YES
//// authViewStyle:SSAuthViewStyleFullScreenPopup
//// viewDelegate:nil
//// authManagerViewDelegate:nil];
//
// //在授权页面中添加关注官方微博
// [authOptions setFollowAccounts:[NSDictionary dictionaryWithObjectsAndKeys:
// [ShareSDK userFieldWithType:SSUserFieldTypeName value:@"ShareSDK"],
// SHARE_TYPE_NUMBER(ShareTypeSinaWeibo),
// [ShareSDK userFieldWithType:SSUserFieldTypeName value:@"ShareSDK"],
// SHARE_TYPE_NUMBER(ShareTypeTencentWeibo),
// nil]];
id<ISSShareOptions> shareOptions = [ShareSDK defaultShareOptionsWithTitle:@"安e帮分享"
oneKeyShareList:[NSArray defaultOneKeyShareList]
qqButtonHidden:YES
wxSessionButtonHidden:YES
wxTimelineButtonHidden:YES
showKeyboardOnAppear:NO
shareViewDelegate:nil
friendsViewDelegate:nil picViewerViewDelegate:nil];
NSArray *shareList = [ShareSDK getShareListWithType: ShareTypeSinaWeibo, ShareTypeWeixiSession, ShareTypeWeixiTimeline, ShareTypeQQ, nil];
//弹出分享菜单
[ShareSDK showShareActionSheet:container
shareList:shareList
content:publishContent
statusBarTips:YES
authOptions:nil
shareOptions:shareOptions
result:^(ShareType type, SSResponseState state, id<ISSPlatformShareInfo> statusInfo, id<ICMErrorInfo> error, BOOL end) {
if (state == SSResponseStateSuccess)
{
NSLog(NSLocalizedString(@"TEXT_ShARE_SUC", @"分享成功"));
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"TEXT_TIPS", @"提示")
message:NSLocalizedString(@"TEXT_ShARE_SUC", @"分享成功")
delegate:nil
cancelButtonTitle:NSLocalizedString(@"TEXT_KNOW", @"知道了")
otherButtonTitles:nil];
[alertView show];
}
else if (state == SSResponseStateFail)
{
NS_APPDebugLog(NSLocalizedString(@"TEXT_ShARE_FAI", @"分享失败,错误码:%d,错误描述:%@"), [error errorCode], [error errorDescription]);
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"TEXT_TIPS", @"提示")
message:[NSString stringWithFormat:NSLocalizedString(@"TEXT_ShARE_FAI", @"分享失败,错误码:%d,错误描述:%@"), [error errorCode], [error errorDescription]]
delegate:nil
cancelButtonTitle:NSLocalizedString(@"TEXT_KNOW", @"知道了")
otherButtonTitles:nil];
[alertView show];
}
}];
这里面已经把授权页面给关掉了,怎么点击微博分享的时候还是会跳转到微博授权页面,不知道原因在哪里
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已经解决,不是代码的问题,只要把sina的URL Scheme,去掉就能把新浪应用认证去掉了。