title: error: missing context for method declaration with FB SDK on react native
body: <p>I thought it would be easy to find similar issue but as fb haven't issues on their github, NO...</p>
  
  <p>I strictly followed the instructions here: <a href="https://developers.facebook.com/docs/ios/getting-started" rel="nofollow noreferrer">https://developers.facebook.com/docs/ios/getting-started</a></p>
  
  <p>but it leverages this error which clearly indicate that what is after the @end is an issue. I understand that I'm declaring methods outside of the compiler scope but as FB isn't really full of information about this, I don't know what to do.</p>
  
  <pre><code>/Users/Jean/dev/mysuperapp/ios/mysuperapp/AppDelegate.m:82:1: error: missing context for method declaration
  - (BOOL)application:(UIApplication *)application 
  ^
  /Users/Jean/dev/mysuperapp/ios/mysuperapp/AppDelegate.m:91:1: error: missing context for method declaration
  - (BOOL)application:(UIApplication *)application 
  ^
  /Users/Jean/dev/mysuperapp/ios/mysuperapp/AppDelegate.m:106:1: error: missing context for method declaration
  - (void)applicationDidBecomeActive:(UIApplication *)application {
  ^
  3 errors generated.
  </code></pre>
  
  <p>I've found this similar issue which says that's because the code for FBSDK is after the @end which seems obvious. But if I move the code just before the @end the compiler complains about missing @end...</p>
  
  <p><a href="https://stackoverflow.com/questions/33673499/missing-context-for-method-declaration">Missing context for method declaration</a></p>
  
  <p>I'm sure it's just about understanding how the compiler works but I'm stuck on this one. I don't know Objective-C at all and I'm very confused with this error.</p>
  
  <p>The entire file:</p>
  
  <pre><code>/**
  * Copyright (c) 2015-present, Facebook, Inc.
  * All rights reserved.
  *
  * This source code is licensed under the BSD-style license found in the
  * LICENSE file in the root directory of this source tree. An additional grant
  * of patent rights can be found in the PATENTS file in the same directory.
  */
  
  #import "AppDelegate.h"
  #import &lt;CodePush/CodePush.h&gt;
  
  #import &lt;React/RCTBundleURLProvider.h&gt;
  #import &lt;React/RCTRootView.h&gt;
  
  #import "RNFIRMessaging.h"
  
  @implementation AppDelegate
  
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
    NSURL *jsCodeLocation;
  
  
    #ifdef DEBUG
    jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
    #else
    jsCodeLocation = [CodePush bundleURL];
    #endif
  
    RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
    moduleName:@"cupido"
    initialProperties:nil
    launchOptions:launchOptions];
    rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
  
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    UIViewController *rootViewController = [UIViewController new];
    rootViewController.view = rootView;
    self.window.rootViewController = rootViewController;
    [self.window makeKeyAndVisible];
  
    // Added for FCM
    [FIRApp configure];
    [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
  
    return YES;
  }
  
  - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler
  {
    [RNFIRMessaging willPresentNotification:notification withCompletionHandler:completionHandler];
  }
  
  #if defined(__IPHONE_11_0)
  - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler
  {
    [RNFIRMessaging didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
  }
  #else
  - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler
  {
    [RNFIRMessaging didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
  }
  #endif
  
  //You can skip this method if you don't want to use local notification
  -(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
    [RNFIRMessaging didReceiveLocalNotification:notification];
  }
  
  - (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
    [RNFIRMessaging didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
  }
  
  
  @end
  
  //  AppDelegate.m
  #import &lt;FBSDKCoreKit/FBSDKCoreKit.h&gt;
  
  - (BOOL)application:(UIApplication *)application 
  didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  
    [[FBSDKApplicationDelegate sharedInstance] application:application
    didFinishLaunchingWithOptions:launchOptions];
    // Add any custom logic here.
    return YES;
  }
  
  - (BOOL)application:(UIApplication *)application 
  openURL:(NSURL *)url 
  options:(NSDictionary&lt;UIApplicationOpenURLOptionsKey,id&gt; *)options {
  
    BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application
    openURL:url
    sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
    annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
    ];
    // Add any custom logic here.
    return handled;
  }
  
  //  AppDelegate.m
  #import &lt;FBSDKCoreKit/FBSDKCoreKit.h&gt;
  - (void)applicationDidBecomeActive:(UIApplication *)application {
    [FBSDKAppEvents activateApp];
  }
  </code></pre>