WCSession error domain code 7005: Device is not Paired

家住魔仙堡 提交于 2019-12-24 14:51:06

问题


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.

来源:https://stackoverflow.com/questions/33567844/wcsession-error-domain-code-7005-device-is-not-paired

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!