嗯,我盡我所能解決這個問題,但絕對沒有運氣。如何替換 - (BOOL)應用程序:openURL:sourceApplication:註釋:(id)註釋
我有這段使用正常工作。但需要解決棄用方法。
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
NSLog(@"%@",url.scheme);
NSString *path = [[NSBundle mainBundle] pathForResource: @"Info" ofType: @"plist"];
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile: path];
NSString *str = [NSString stringWithFormat:@"fb%@",[dict objectForKey: @"FacebookAppID"]] ;
BOOL result = [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation
];
if (result) {
return YES;
}
return [self.instagram handleOpenURL:url];
}
我看到它現在已被棄用。
iOS(4.2及更高版本)已棄用:使用應用程序:openURL:options:取而代之。其中產生以下。但這不是所謂的。我錯過了什麼?
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options{
NSLog(@"%@",url.scheme);
NSString *path = [[NSBundle mainBundle] pathForResource: @"Info" ofType: @"plist"];
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile: path];
NSString *str = [NSString stringWithFormat:@"fb%@",[dict objectForKey: @"FacebookAppID"]] ;
BOOL result = [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation
];
if (result) {
return YES;
}
return [self.instagram handleOpenURL:url];
}
在預先感謝您的評論和任何幫助,非常感謝您。
凡將這個簡單的解決方案邏輯被執行?如果在didFinishLaunchingWithOptions中,URL不可用,並且我引用了本文以訪問url方案,但未解決。它將在'application:openURL:options:'中。[鏈接](http://www.idev101.com/code/Objective-C/custom_url_schemes.html) – JetSet
。FBSDK將訪問plist並使用應用程序方案調用此方法。 – quant24
謝謝!我會試一試。但主要的是我不知道如何調用'application:openURL:options:'方法。 – JetSet