WCSession error domain code 7005: Device is not Pa

2019-08-14 01:52发布

问题:

By making use of WCSession sendMessage, I am getting ErrorDomainCode 7005 constantly within one of my Projects.

I get this error when testing with all simulators and also on real iPhone and paired Apple Watch. Devices are definitely paired.

The exact same code works fine for other (newer) projects that I created from scratch together with a Watch Extension.

I do have this problem only in an older Project where I have added a watch extension recently.

The watch app simply does not communicate with the iPhone app.

Following is my Code:

AppDelegate in didFinishLaunchingWithOptions:

 if ([WCSession isSupported]) {
        [[WCSession defaultSession] setDelegate:self];
        [[WCSession defaultSession] activateSession];
    }

AppDelegate: Receiver of Message

- (void)session:(WCSession *)session
didReceiveMessage:(NSDictionary<NSString *, id> *)message
   replyHandler:(void (^)(NSDictionary<NSString *, id> *_Nonnull))replyHandler {

    replyHandler(@{ @"message" : @"OK" });

}

Watch Extension InterfaceController: awakeWithContext

- (void)awakeWithContext:(id)context {
    [super awakeWithContext:context];

    [[WCSession defaultSession] isReachable];

    if ([WCSession isSupported]) {
        [[WCSession defaultSession] setDelegate:self];
        [[WCSession defaultSession] activateSession];
    }

  [self.wcSession sendMessage:applicationData
                               replyHandler:^(NSDictionary *reply) {

NSLog(@"OK");
                                   }
                                   errorHandler:^(NSError *error) {
                                       //catch any errors here
                                        [self.testLabel setText:[error.userInfo objectForKey:@"NSLocalizedDescription"]];
                                   }
         ];

This is what I've tried up to now:

  • reset content and settings of all simulators
  • deleted watch app from watch &from iPhone
  • via settings in Watch App on Phone: Removed Watch Extension for Phone App and reinstalled it
  • Tried setting up the iPhone WCSession in AppDelegate INIT Method

I am struggling with this issue for many days now. So every hint is highly appreciated.