【发布时间】:2015-01-14 18:42:56
【问题描述】:
我在尝试登录 Google Plus 时遇到问题,在返回应用程序时发送我的用户名和密码后我的应用程序崩溃。
错误发生在这一行:
BOOL openURL(id self, SEL _cmd, UIApplication* application, NSURL* url, NSString* sourceApplication, id annotation){
[GPPURLHandler handleURL:url sourceApplication:@"com.google.chrome.ios" annotation:nil];
}
//...
我进入设备控制台:
: *** 由于未捕获的异常而终止应用程序 'NSInvalidArgumentException',原因:'无法创建 NSPersistentStoreCoordinator 与 nil 模型'
然后使用打印在控制台中的 url 我尝试:
NSURL *fixedURL = [NSURL URLWithString:@"com.domain.xxxxxx:/oauth2callback?state=75029341&code=4/hy789ysdfhfRA8cuIeHbO0fP3p1oXcFeCnYJe--vZgc.klaHKD1A8zws76f7678df6782M1BcwvNlQI&authuser=0&num_sessions=1&prompt=consent&session_state=dca3e8a678sdf678a6f7d880e02bcf5155e5822c038..5f88"];
[GPPURLHandler handleURL:fixedURL sourceApplication:@"com.google.chrome.ios" annotation:nil];
//...
使用这些代码没有任何反应
那我试试:
NSString *urlString =[NSMutableString stringWithFormat:@"%@:/oauth2callback?%@", [url scheme],[url query]];
NSURL *fixedURL = [NSURL URLWithString:urlString];
//...
并得到第一个错误。
在属性列表键中
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.domain.xxxxxx</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.domain.xxxxxx</string>
</array>
<key>CFBundleURLTypes</key>
<string>Editor</string>
</dict>
</array>
<key>GPGApplicationID</key>
<string>123123123-0fnaerghgic4er3g9cmn045daasl0u1u.apps.googleusercontent.com</string>
我做错了什么?
【问题讨论】:
标签: ios google-plus google-play-services