Google+ 用于 iOS 崩溃的 SDK
Google+ SDK for iOS Crash
我在使用 iOS (1.7.1) 的最新 Google+ SDK 时遇到问题。
更具体地说 - 崩溃(下):
- 包含 Google SDK 包
- 添加了info.plistURL标识符
- 导致崩溃的代码如下
didTapGoogle加号按钮:
if (![AppController me].isNetworkAvailable) {
[KaiwaAlert presentSimpleAlert:self.view.bounds
title:[LI18n localizedString:@"Notice"]
message:[LI18n localizedString:@"This operation requires an active internet connection"]
buttonTitle:[LI18n localizedString:@"OK"]];
return;
}
GPPSignIn *signInGooglePlus = [GPPSignIn sharedInstance];
signInGooglePlus.delegate = self;
signInGooglePlus.clientID = kGooglePlusClientId;
signInGooglePlus.shouldFetchGoogleUserEmail = YES;
signInGooglePlus.shouldFetchGooglePlusUser = YES;
signInGooglePlus.scopes = [NSArray arrayWithObjects:@"profile", kGTLAuthScopePlusLogin, @"email",nil];
[signInGooglePlus authenticate];
登录后使用的委托方法:(void)finishedWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error
if (error) {
LogError(@"Received error %@ and auth object %@",error, auth);
// show message
[KaiwaAlert presentSimpleAlert:self.view.bounds
title:[LI18n localizedString:@"Share on Google+"]
message:[LI18n localizedString:@"Could not share to Google+ - please retry."]
buttonTitle:[LI18n localizedString:@"OK"]];
} else {
id<GPPNativeShareBuilder> shareBuilder = [[GPPShare sharedInstance] nativeShareDialog];
NSString *message = [[AppController me] configuredShareStringForUser];
if ([NSString isNullOrEmpty:message]) {
return;
}
[shareBuilder setPrefillText:message];
//[shareBuilder setURLToShare:[NSURL URLWithString:[AppConstants getShareUrl]]];
[shareBuilder open];
}
现在发生的是 [shareBuilder open] 通过并且控制权脱离消息 - 我可以看到 Google 共享对话框几乎没有打开并且应用程序崩溃并出现以下崩溃:
Incident Identifier: BFF6428D-CEFD-409F-A099-9401E81008B1
CrashReporter Key: 2BE89934-100A-4FC4-9ECD-29F90CD740C3
Hardware Model: iPhone7,2
Process: EKaiwaNow [284]
Path: /var/mobile/Containers/Bundle/Application/C3385FF5-E55E-4403- B04C-9D7F9B341A7D/EKaiwaNow.app/EKaiwaNow
Identifier: com.eikaiwanow.app.ios
Version: 500
Code Type: ARM-64
Parent Process: ??? [1]
Date/Time: 2015-06-25T08:45:18Z
OS Version: iPhone OS 9.0 (13A4280e)
Report Version: 104
Exception Type: SIGABRT
Exception Codes: #0 at 0x1971cf1e0
Crashed Thread: 0
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]'
Last Exception Backtrace:
0 ??? 0x00000001821cf38c 0x0 + 0
1 ??? 0x0000000196873f2c 0x0 + 0
2 ??? 0x00000001820bcda8 0x0 + 0
3 ??? 0x00000001820bcc40 0x0 + 0
4 EKaiwaNow 0x000000010041f484 -[GPPOzLogger flushEventsAndBuildQuery] + 664
5 EKaiwaNow 0x00000001003f1664 -[GPPServiceBase executeQuery:usingService:batchLogsFrom:completionHandler:] + 820
6 EKaiwaNow 0x0000000100421c04 -[GPPService executeQuery:usingService:batchLogsFrom:completionHandler:] + 576
7 EKaiwaNow 0x0000000100421f40 __72-[GPPService executeQuery:usingService:batchLogsFrom:completionHandler:]_block_invoke + 116
8 EKaiwaNow 0x00000001004221d4 __72-[GPPService executeQuery:usingService:batchLogsFrom:completionHandler:]_block_invoke109 + 464
9 EKaiwaNow 0x00000001003f2034 __76-[GPPServiceBase executeQuery:usingService:batchLogsFrom:completionHandler:]_block_invoke + 1896
10 EKaiwaNow 0x000000010043e3a4 -[GTLService handleParsedObjectForFetcher:] + 1392
11 ??? 0x0000000183141d60 0x0 + 0
12 ??? 0x0000000182186d10 0x0 + 0
13 ??? 0x0000000182186724 0x0 + 0
14 ??? 0x0000000182184478 0x0 + 0
15 ??? 0x00000001820b10d0 0x0 + 0
16 ??? 0x000000018d02b170 0x0 + 0
17 ??? 0x00000001877c25f0 0x0 + 0
18 EKaiwaNow 0x000000010012e34c main (main.m:57)
19 ??? 0x00000001970b28b8 0x0 + 0
我几乎到处都查过了,但我找不到造成这种情况的原因。
我假设一些 Google+ SDK 问题?
Google 发布了最新的 登录 SDK,用于使用 Google Plus 登录。如果你使用之前的 SDK ,苹果会拒绝应用程序。请参阅讨论 here。
Google 登录 SDK 2.0 记录在新的开发站点上:
https://developers.google.com/identity/sign-in/ios/
试试这个。可能对你有帮助
我在使用 iOS (1.7.1) 的最新 Google+ SDK 时遇到问题。
更具体地说 - 崩溃(下):
- 包含 Google SDK 包
- 添加了info.plistURL标识符
- 导致崩溃的代码如下
didTapGoogle加号按钮:
if (![AppController me].isNetworkAvailable) {
[KaiwaAlert presentSimpleAlert:self.view.bounds
title:[LI18n localizedString:@"Notice"]
message:[LI18n localizedString:@"This operation requires an active internet connection"]
buttonTitle:[LI18n localizedString:@"OK"]];
return;
}
GPPSignIn *signInGooglePlus = [GPPSignIn sharedInstance];
signInGooglePlus.delegate = self;
signInGooglePlus.clientID = kGooglePlusClientId;
signInGooglePlus.shouldFetchGoogleUserEmail = YES;
signInGooglePlus.shouldFetchGooglePlusUser = YES;
signInGooglePlus.scopes = [NSArray arrayWithObjects:@"profile", kGTLAuthScopePlusLogin, @"email",nil];
[signInGooglePlus authenticate];
登录后使用的委托方法:(void)finishedWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error
if (error) {
LogError(@"Received error %@ and auth object %@",error, auth);
// show message
[KaiwaAlert presentSimpleAlert:self.view.bounds
title:[LI18n localizedString:@"Share on Google+"]
message:[LI18n localizedString:@"Could not share to Google+ - please retry."]
buttonTitle:[LI18n localizedString:@"OK"]];
} else {
id<GPPNativeShareBuilder> shareBuilder = [[GPPShare sharedInstance] nativeShareDialog];
NSString *message = [[AppController me] configuredShareStringForUser];
if ([NSString isNullOrEmpty:message]) {
return;
}
[shareBuilder setPrefillText:message];
//[shareBuilder setURLToShare:[NSURL URLWithString:[AppConstants getShareUrl]]];
[shareBuilder open];
}
现在发生的是 [shareBuilder open] 通过并且控制权脱离消息 - 我可以看到 Google 共享对话框几乎没有打开并且应用程序崩溃并出现以下崩溃:
Incident Identifier: BFF6428D-CEFD-409F-A099-9401E81008B1
CrashReporter Key: 2BE89934-100A-4FC4-9ECD-29F90CD740C3
Hardware Model: iPhone7,2
Process: EKaiwaNow [284]
Path: /var/mobile/Containers/Bundle/Application/C3385FF5-E55E-4403- B04C-9D7F9B341A7D/EKaiwaNow.app/EKaiwaNow
Identifier: com.eikaiwanow.app.ios
Version: 500
Code Type: ARM-64
Parent Process: ??? [1]
Date/Time: 2015-06-25T08:45:18Z
OS Version: iPhone OS 9.0 (13A4280e)
Report Version: 104
Exception Type: SIGABRT
Exception Codes: #0 at 0x1971cf1e0
Crashed Thread: 0
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]'
Last Exception Backtrace:
0 ??? 0x00000001821cf38c 0x0 + 0
1 ??? 0x0000000196873f2c 0x0 + 0
2 ??? 0x00000001820bcda8 0x0 + 0
3 ??? 0x00000001820bcc40 0x0 + 0
4 EKaiwaNow 0x000000010041f484 -[GPPOzLogger flushEventsAndBuildQuery] + 664
5 EKaiwaNow 0x00000001003f1664 -[GPPServiceBase executeQuery:usingService:batchLogsFrom:completionHandler:] + 820
6 EKaiwaNow 0x0000000100421c04 -[GPPService executeQuery:usingService:batchLogsFrom:completionHandler:] + 576
7 EKaiwaNow 0x0000000100421f40 __72-[GPPService executeQuery:usingService:batchLogsFrom:completionHandler:]_block_invoke + 116
8 EKaiwaNow 0x00000001004221d4 __72-[GPPService executeQuery:usingService:batchLogsFrom:completionHandler:]_block_invoke109 + 464
9 EKaiwaNow 0x00000001003f2034 __76-[GPPServiceBase executeQuery:usingService:batchLogsFrom:completionHandler:]_block_invoke + 1896
10 EKaiwaNow 0x000000010043e3a4 -[GTLService handleParsedObjectForFetcher:] + 1392
11 ??? 0x0000000183141d60 0x0 + 0
12 ??? 0x0000000182186d10 0x0 + 0
13 ??? 0x0000000182186724 0x0 + 0
14 ??? 0x0000000182184478 0x0 + 0
15 ??? 0x00000001820b10d0 0x0 + 0
16 ??? 0x000000018d02b170 0x0 + 0
17 ??? 0x00000001877c25f0 0x0 + 0
18 EKaiwaNow 0x000000010012e34c main (main.m:57)
19 ??? 0x00000001970b28b8 0x0 + 0
我几乎到处都查过了,但我找不到造成这种情况的原因。 我假设一些 Google+ SDK 问题?
Google 发布了最新的 登录 SDK,用于使用 Google Plus 登录。如果你使用之前的 SDK ,苹果会拒绝应用程序。请参阅讨论 here。
Google 登录 SDK 2.0 记录在新的开发站点上:
https://developers.google.com/identity/sign-in/ios/
试试这个。可能对你有帮助