我已在Info.plist
中创建了一个应用URL方案,以便我可以处理oauth重定向。
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>Lifestream</string>
</array>
<key>CFBundleURLName</key>
<string>com.sullinger.lifestream.callback</string>
</dict>
</array>
当我将应用程序部署到模拟器或设备时,然后关闭应用程序,打开Safari并输入Lifestream://com.sullinger.lifestream.callback
,Safari告诉我它无法找到该网页。我是否错过了在操作系统中注册URL方案的步骤?
答案 0 :(得分:0)
尝试使用:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.sullinger.lifestream.callback</string>
<key>CFBundleURLSchemes</key>
<array>
<string>callback</string>
</array>
</dict>
</array>
在App代表中:
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
NSLog(@"url recieved: %@", url);
NSLog(@"query string: %@", [url query]);
NSLog(@"host: %@", [url host]);
NSLog(@"url path: %@", [url path]);
return YES;
}