gpt4 book ai didi

ios - 如何使用 google-plus-ios-sdk-1.7.1 sdk 登录 google-plus?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:03:34 35 4
gpt4 key购买 nike

我正在使用 Google Plus 开发 iPhone 应用程序。

当我尝试登录时,出现 401 错误。

我使用的是 google-plus-ios-sdk-1.7.1 sdk。

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

// Override point for customization after application launch.

[GPPSignIn sharedInstance].clientID = kClientID;
// Read Google+ deep-link data.
[GPPDeepLink setDelegate:self];
[GPPDeepLink readDeepLinkAfterInstall];

return YES;
}

shareviewcontroller中:

-(void)viewDidLoad
{
[super viewDidLoad];


GPPSignIn *signIn = [GPPSignIn sharedInstance];
signIn.shouldFetchGooglePlusUser = YES;
signIn.scopes = @[ kGTLAuthScopePlusLogin ];
signIn.delegate = self;

[[GPPSignIn sharedInstance] trySilentAuthentication];

_shareConfiguration = [ShareConfiguration sharedInstance];
_shareConfiguration.useNativeSharebox = YES;
//_shareConfiguration.deepLinkEnabled = YES;
_shareConfiguration.mediaAttachmentEnabled = YES;
}

-(void)btnGoogleShare_Action
{

if ([GPPSignIn sharedInstance].authentication) {
id<GPPShareBuilder> shareBuilder = [[GPPShare sharedInstance] nativeShareDialog];
[(id<GPPNativeShareBuilder>)shareBuilder attachImage:self.imgView.image];
[(id<GPPNativeShareBuilder>)shareBuilder setTitle:self.dict[@"title"] description:self.dict[@"comment"] thumbnailURL:nil];
[shareBuilder open];
}
else
{
AppDelegate *appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;

GPPSignInButton *sign = [[GPPSignInButton alloc] init];

if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) {

appDelegate.alert = [[UIAlertView alloc] initWithTitle:@"Sign to Google +" message:@"After login to Google+, Please retry again." delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Cancel", nil];

[appDelegate.alert setValue:sign forKey:@"accessoryView"]; //works only in iOS7
} else {

appDelegate.alert = [[UIAlertView alloc] initWithTitle:@"Sign to Google +" message:@"After login to Google+, Please retry again.\n\n\n" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Cancel", nil];

sign.frame = CGRectMake(70, 85, 100, 40);
[appDelegate.alert addSubview:sign];
}


[GPPSignInButton class];
[appDelegate.alert show];
}
}



下面是截图,谁能帮帮我?


http://i.stack.imgur.com/yEv2x.png

最佳答案

正如评论中提到的,第一个问题已经讨论过了here .

有关文本和媒体同时发布的第二个问题在 API 文档中提到 GPPNativeShareBuilder Protocol Reference .根据此文档,您不能将 attachImagesetTitle 函数一起使用。函数 setPrefillText 可以解决您的问题。

关于ios - 如何使用 google-plus-ios-sdk-1.7.1 sdk 登录 google-plus?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26235833/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com