watch-connectivity / react-native-watch-connectivity

Enable communication between apple watch app and react native
http://mtford.co.uk/react-native-watch-connectivity/
MIT License
713 stars 92 forks source link

Neither Watch or iPhone know one another are installed #118

Closed colin1227 closed 1 year ago

colin1227 commented 1 year ago

Hi Michael,

I am building a Apple Watch app for a iPhone app written in react-native and am extremely thankful you wrote this library. I have recently been deploying the watch app to Testflight with just a button to send and receive messages to my iphone app released with expo. Unfortunately I have been running into issues sending messages from either application.

react-native app error:

{
 ...,
"code": "EWCERRORDOMAIN7006", 
"domain": "WCErrorDomain",
"message": "Watch app is not installed.",
...
}

Watch app error:

Domain=WCErrorDomain
Code=7018
"Companion app is not installed."

I believe the issue specifically is with the WKCompanionAppBundleIdentifier and/or WKAppBundleIdentifier values although I am unsure if the issue is something else in the project's plist or elsewhere.

Most of the forums I have looked at have been outdated or have not worked. I took your advice and have been building to physical devices but I am at a loss as to why the apps do not acknowledge each other.

Extra info:

asgu commented 1 year ago

Having the same problem. Did you found any workaround?

colin1227 commented 1 year ago

Having the same problem. Did you found any workaround?

Not yet.

There is a possible solution I am looking at for removing the react app from our expo pipeline and ejecting the code into native Apple and Android code. I am still selling my boss on this idea but as it will take time to set up a new CI/CD pipeline for a one app not to mention changing the way the iPhone/Android app repository is set up.

I did a test about a month ago with a swift phone app with the watch app within the same project and the apps spoke to each other as expected. Although, as you might expect doing this all in swift subverted using this library.

All that said, I'd definitely prefer using this library and keeping everything in react-native.

yolpsoftware commented 1 year ago

App bundles and bundle identifiers are a pain, especially when working with Watch companion apps.

Does this error happen all the time, or just occasionally? In other words, have you yet succeeded in sending one message between Phone and Watch?

colin1227 commented 1 year ago

App bundles and bundle identifiers are a pain, especially when working with Watch companion apps.

Does this error happen all the time, or just occasionally? In other words, have you yet succeeded in sending one message between Phone and Watch?

I have seen ~this~ these errors every time

yolpsoftware commented 1 year ago

Then I'm pretty sure the error is not with this library, but with the setup. I do not remember all details, but you need three bundle IDs: one for the phone app and two for the companion watch app. Believe me, once your setup is correct, it will work.

One thing you could do is compare your setup to the example app. Make sure you have bundle IDs 1, 2 and 3 at the exact same places as in the example app.