0

Ich arbeite an einer Parse-Anwendung, wo ich Erlaubnis von Benutzer nach dem Login benötigen. Ich benutze PFFacebookUtilsV4 Framework. Ich habe versuchtPFFacebookUtils logInWithPublishPermissions lädt keine Erlaubnis Bildschirm

[[PFFacebookUtils facebookLoginManager] logInWithPublishPermissions:@[@"publish_actions"] fromViewController:controller handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { 
    if (result.isCancelled) 
    { 
     NSLog(@"permission denied"); 
    }else{ 
     NSLog(@"permission granted"); 
    } 
}]; 

dieser Pop-up-Safari-Browser, aber lädt nichts. mache ich etwas falsch mit dem obigen Code oder was könnte das mögliche Problem sein?

AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
     [PFFacebookUtils initializeFacebookWithApplicationLaunchOptions:nil]; 
     return [[FBSDKApplicationDelegate sharedInstance] application:application 
             didFinishLaunchingWithOptions:launchOptions]; 
    } 

- (BOOL)application:(UIApplication *)application 
      openURL:(NSURL *)url 
    sourceApplication:(NSString *)sourceApplication 
     annotation:(id)annotation { 
     return [[FBSDKApplicationDelegate sharedInstance] application:application 
                  openURL:url 
               sourceApplication:sourceApplication 
                 annotation:annotation]; 
} 

- (void)applicationDidBecomeActive:(UIApplication *)application { 
    [FBSDKAppEvents activateApp]; 
} 

plist

<key>NSAllowsArbitraryLoads</key> 
<true/> 
<key>LSApplicationQueriesSchemes</key> 
<array> 
    <string>fbapi</string> 
    <string>fb-messenger-api</string> 
    <string>fbauth2</string> 
    <string>fbshareextension</string> 
</array> 
<key>FacebookAppID</key> 
<string>XYZ</string> 
+0

Können Sie mir zeigen Sie AppDelegate ? –

+0

Was sind die Inhalte Ihrer .plist? – Simon

+0

Danke @MilanMendpara Ich habe eine Antwort erstellt –

Antwort

0

In Swift Ich habe dies:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
    // Override point for customization after application launch. 

    let configuration = ParseClientConfiguration { 
     $0.applicationId = "MY_APP_ID" 
     $0.server = "MY_SERVER_URL" 
    } 
    Parse.initialize(with: configuration) 

    PFFacebookUtils.initializeFacebook(applicationLaunchOptions: launchOptions) 

    return true 
} 

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { 
    return FBSDKApplicationDelegate.sharedInstance().application(application, open: url, sourceApplication: sourceApplication, annotation: annotation) 
} 

func applicationDidBecomeActive(_ application: UIApplication) { 
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 
    FBSDKAppEvents.activateApp() 
} 

Sie können wie folgt konfiguriert werden:

<key>FacebookAppID</key> 
<string>YOU_APP_ID</string> 
<key>FacebookDisplayName</key> 
<string>YOUR_DISPLAY_NAME</string> 
<key>LSApplicationQueriesSchemes</key> 
<array> 
    <string>fbapi</string> 
    <string>fb-messenger-api</string> 
    <string>fbauth2</string> 
    <string>fbshareextension</string> 
</array> 

mit Erlaubnis anzumelden habe ich dies:

PFFacebookUtils.logInInBackground(withReadPermissions: ["public_profile"]) { (user: PFUser?, error: Error?) in 
     if error == nil, let ruser = user { 
      print("WORKS") 
     } 
     print("EPIC FAIL") 
    } 
+0

nicht Relog arbeiten obwohl –

+0

@MilanMendpara ich meine Antwort aktualisieren habe –

+0

noch kein Glück :( –

0

Try this! Einfache Lösung :) Außerdem sollte der Nutzer eine Tester- oder Admin-Rolle haben, um Ihre App zu testen, wenn Ihre App nicht von Facebook genehmigt wurde. https://developers.facebook.com/docs/apps/test-users

  • LSApplicationQueriesSchemes
  • Facebook App-ID und App-Anzeigename
  • Muss
  • App URL-Typ wie fb haben
  • Exception Domains

    <key>LSApplicationQueriesSchemes</key> 
    <array> 
        <string>fbapi</string> 
        <string>fb-messenger-api</string> 
        <string>fbauth</string> 
        <string>fbauth2</string> 
        <string>fbshareextension</string> 
    </array> 
    <key>FacebookAppID</key> 
    <string>xxxFACEBOOKIDxxx</string> 
    <key>FacebookDisplayName</key> 
    <string>App Name</string> 
    
    
    <key>NSAllowsArbitraryLoads</key> 
    <true/> 
    <key>NSAllowsArbitraryLoadsInWebContent</key> 
    <true/> 
    <key>NSExceptionDomains</key> 
    <dict> 
        <key>facebook.com</key> 
        <dict> 
         <key>NSExceptionAllowsInsecureHTTPLoads</key> 
         <true/> 
         <key>NSExceptionRequiresForwardSecrecy</key> 
         <false/> 
         <key>NSIncludesSubdomains</key> 
         <true/> 
         <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key> 
         <true/> 
        </dict>   
    </dict> 
    
    
    <key>CFBundleURLTypes</key> 
    <array> 
        <dict> 
         <key>CFBundleTypeRole</key> 
         <string>Editor</string> 
         <key>CFBundleURLSchemes</key> 
         <array> 
          <string>fbxxxFACEBOOKIDxxx</string> // should have URL types 
         </array> 
        </dict> 
    </array>