Risposte:
Puoi continuare a utilizzare gli schemi URL quando crei la tua app per iOS 9 e desideri chiamare schemi URL, ora dovrai dichiararli nella Info.plist delle tue app. Esiste una nuova chiave, LSApplicationQueriesSchemes , e qui sarà necessario aggiungere l'elenco di schemi che si desidera siano canOpenURL.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbauth2</string>
</array>
Se stai usando iOS9, questo è importante per aggiornare il tuo file info.plist. Devi solo fare 3 passaggi 1. Vai a info.plist 2. Aggiungi un campo e precisamente il tipo di dati NSArray LSApplicationQueriesSchemes. 3. Aggiungere un elemento del tipo di dati NSString chiamandolo fbauth2.
Questo è tutto. Pulisci e corri. l'avviso non verrà più visualizzato.
Per quanto riguarda la versione 4.6.0 di FaceBook SDK, aggiungi la seguente chiave al tuo file plist:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
notdirvi Impegni Questo, bene che si indicò!
Segui semplicemente la spiegazione di Facebook: Preparare le tue app per iOS9
Apple lo menziona nella sua: Privacy e Keynote delle tue app 2015
Per favore, non aggiungere questo al tuo CFBundleURLSchemes ... che in realtà HIJACK tenterà qualsiasi tentativo di app di Facebook, causando un popup che mostra la finestra di dialogo "X app vuole aprire" ...
NON vuoi farlo.
CF:
https://developers.facebook.com/docs/applinks/ios
https://www.fireeye.com/blog/threat-research/2015/04/url_masques_on_apps.html
https://www.reddit.com/r/workflow/comments/2tlx29/get_url_scheme_of_any_app
Ho ottenuto questo durante l'esecuzione dei test del Kiwi poiché il nostro obiettivo di test non aveva accesso al pacchetto principale. Quindi ho dovuto aggiungere una condizione a isRegisteredCanOpenURLSchemeinFBSDKInternalUtility.m
+ (BOOL)isRegisteredCanOpenURLScheme:(NSString *)urlScheme
{
static dispatch_once_t fetchBundleOnce;
static NSArray *schemes = nil;
dispatch_once(&fetchBundleOnce, ^{
schemes = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"LSApplicationQueriesSchemes"];
if (!schemes) { // This is a work around for our Kiwi tests as the Specs target doesn't have access to main bundle
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
NSString *path = [bundle pathForResource:@"Info" ofType:@"plist"];
NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfFile:path];
schemes = [dictionary valueForKey:@"LSApplicationQueriesSchemes"];
}
});
return [schemes containsObject:urlScheme];
}
Per creare la tua app per iOS 9: (per la condivisione di Facebook)
Info.plistfile, aggiungi un altro campo LSApplicationQueriesSchemes in Elenco proprietà informazioni e imposta il tipo di dati Arrayo NSArray.Stringo NSString.fbauth2, fbshareextension, fbapicome valore di oggetto.Segui questa foto :
Write the below code in your info.plist under the **LSApplicationQueriesScheme**
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbauth</string>
<string>fbauth2</string>
<string>fb-messenger-api20140430</string>
<string>fb-messenger-platform-20150128</string>
<string>fb-messenger-platform-20150218</string>
<string>fb-messenger-platform-20150305</string>
Puoi provare con il codice qui sotto in swift 5.0
extension Bundle {
static let externalURLSchemes: [String] = {
guard let urlTypes = main.infoDictionary?["LSApplicationQueriesSchemes"]
as? [String] else {
return []
}
return urlTypes
}()
}
Puoi chiamare usando Bundle
guard Bundle.externalURLSchemes.contains(URLScheme) else {
return
}