ios - WatchConnectivity sendMessage:replyHandler: don't work when linker have flag -ObjC -


i have project external libraries, project use -objc linker flag these libraries. without -objc project crash. , want add support watch os 2. have problem: until linker has flag -objc method -sendmessage:replyhandler: return error like

error domain=wcerrordomain code=7014 "payload not delivered." userinfo={nslocalizeddescription=payload not delivered.} 

i can't delete flag (-objc), watch doesn't work. if user tap @ button need send info iphone. , ways sending info have problems too. system add messages queue , keep them forever. have ideas ?

linker flag should not effect watchkit connectivity. here several troubleshooting procedures.

  1. you have make sure delegate method implemented on device receives message.

-(void)session:(wcsession *)session didreceivemessage:(nsdictionary<nsstring *,id> *)message

  1. in comments, said data sending simple dictionary. watchkit connectivity doesn't allow send custom class objects.

  2. also try restart simulator or device. simulators, watchkit connectivity fails. rebuild , restart help.

these usual mistake people make (or made) wathkit connectivity. no code should block watchkit connectivity. please read apple's documentation closely specifics of delegates , protocols. let me know if have questions. luck!


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -