title: Assistance with WatchConnectivity - Objective-c
body: <p>I have been attempting to add a WatchKit target to an existing app written in Objc and have been completely unable to get the messaging working.  When I run the extension, start the session, and check for reachability everything is fine, I am showing the container app is reachable from the extension.  However, when I send a message, the phone application does not wake up.  From all of the documentation and samples that I have seen, the phone application should run in the background, however, this is not happening.  Am I missing something?  Any help would be appreciated.</p>
  
  <p>Attached is the associated code:</p>
  
  <p>From the InterfaceController.m of the extension, I am calling:</p>
  
  <pre><code>[[WCSession defaultSession] sendMessage:@{@"message":@"begin"} replyHandler:nil errorHandler:nil];
  </code></pre>
  
  <p><strong><em>ExtensionDelegate.h</em></strong></p>
  
  <pre><code>#import &lt;WatchKit/WatchKit.h&gt;
  #import &lt;WatchConnectivity/WatchConnectivity.h&gt;
  
  @interface ExtensionDelegate : NSObject &lt;WKExtensionDelegate,WCSessionDelegate&gt;
  
  @end
  </code></pre>
  
  <p><strong><em>ExtensionDelegate.m</em></strong></p>
  
  <pre><code>- (void)applicationDidFinishLaunching {
      // Perform any final initialization of your application.
      if ([WCSession isSupported]) {
          WCSession *session = [WCSession defaultSession];
          session = [WCSession defaultSession];
          session.delegate = self;
          [session activateSession];
          if (session.isReachable) {
              NSLog(@"Able to reach app.");
      }
     }
  }
  </code></pre>
  
  <p><strong><em>IOS AppDelegate.h</em></strong></p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import "objShoppingList.h"
  #import "databaseController.h"
  #import &lt;WatchConnectivity/WatchConnectivity.h&gt;
  @interface AppDelegate : UIResponder &lt;UIApplicationDelegate&gt;
  
  @end
  </code></pre>
  
  <p><strong><em>IOS AppDelegate.m</em></strong></p>
  
  <pre><code>#import "AppDelegate.h"
  @import CoreLocation;
  @interface AppDelegate ()&lt;CLLocationManagerDelegate, WCSessionDelegate&gt;{
      CLLocationManager *locationManager;
      WCSession *session;
  }
  @end
  @implementation AppDelegate
  
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  
      // Override point for customization after application launch.
      if ([WCSession isSupported]) {
          [WCSession defaultSession].delegate = self;
          session = [WCSession defaultSession];
          session.delegate = self;
          NSLog(@"Sessiopn on phone starting");
          [[WCSession defaultSession] activateSession];
      }
      NSLog(@"iphone app starting");
  
   . . .
     return YES;
  }
  - (void)session:(nonnull WCSession *)session didReceiveMessage:(nonnull NSDictionary&lt;NSString *,id&gt; *)message replyHandler:(nonnull void (^)(NSDictionary&lt;NSString *,id&gt; * __nonnull))replyHandler {
  
      // In this case, the message content being sent from the app is a simple begin message. This tells the app to wake up and begin sending location information to the watch.
      NSLog(@"Reached IOS APP");
  }
  -(void)session:(WCSession *)session didReceiveMessage:(NSDictionary&lt;NSString *,id&gt; *)message{
      NSLog(@"Reached IOS APP");
  }
  </code></pre>
  
  <p>@end</p>
  
  <p>Every test that is done, the IOS app does not start, and I do not receive the NSLog message from <strong><em>didFinishLaunchingWithOptions</em></strong></p>
  
  <p>Any help would be greatly appreciated.</p>