I have been attempting to make an Apple Watch extension and WatchKit app with my firebase application, but every time I make a connection in the extension code, the watch crashes. By connection I mean adding an observer to my Firebase reference. Is firebase not compatible on Apple Watch extensions? Or is there something in firebase that Apple prevents on watches (something like web sockets) that firebase won't be able to work around?
Related
I am trying to integrate Sendbird with iOS in swift. Outgoing call is working fine for me. I am not getting any Push for incoming calls. neither of the delegate methods of cxproviderdelegate are not getting called. Can any one help me to understand how to implement the same?
I have uploaded all the voip and push notification certificates on sendBird portal. Same certificates are working fine with FCM for receiving push from FCM.
Rishi,
Typically when we see issues with push notifications for iOS, it stems from a few things.
The APNs .p12 certificate was not uploaded to the dashboard. You mention you've done this but are testing with FCM. We require the APNs Certs for our Swift SDK.
The iOS Device is not registering the User Token to Sendbird (Can be checked by looking at Users > { User } > Push Notification
If you have not already, I'd highly take a look at the iOS Calls Sample App and compare its implementation to yours.
Unfortunately without a lot more information it's difficult to guide you on how to properly implement iOS Calls in Swift. You may consider utilizing their Community for more back and forth conversations.
I am creating an independent Apple Watch app that is not linked to an iPhone app. How can I request access to HealthKit data directly from the Apple Watch without requesting the HealthKit data via an iPhone app.
Apple recently announced that developers could now create independent Apple Watch apps in WWDC 2019, but I'm not finding documentation on how to use HealthKit on independent apps. I started following the instructions on this page here
https://developer.apple.com/documentation/healthkit/setting_up_healthkit
but the problem that I'm running into is that I can't figure out how to set the necessary custom messages for NSHealthShareUsageDescription and NSHealthUpdateUsageDescription. Apples documentation says to do this through the Info.plist, but I can't find these options anywhere for the just the Apple Watch.
Can anyone show how to use HealthKit for an independent Apple Watch app?
In Xcode's project navigator on the left, your WatchKit extension group contains the Info.plist where you'll add your NSHealthShareUsageDescription and NSHealthUpdateUsageDescription messages. Add the HealthKit setup and authorization code from the article you linked in say, your extension delegate, and you're good to go.
I am building a workout app for Apple Watch with watchOS 5.
I am storing workout settings in UserDefaults plist. When the watch extension is launched I try to read the UserDefaults and have the workout settings restored for the user.
According to Apple Documentation
Additionally, iOS automatically forwards a read-only copy of your iOS
app’s preferences to Apple Watch. Your WatchKit extension can read
those preferences using an NSUserDefaults object, but it cannot make
changes directly to the defaults database.
If your Watch app needs to change the values stored in the defaults
database, use the Watch Connectivity framework to send the values back
to your iOS app, and save the values there.
Since UserDefaults is just read only for watch Extension, If user changes any setting on the watch, I send that settings to iPhone with WatchConnectivity and store it into UserDefaults on iPhone. So the next time user launches watch Extension he should get updated userDefaults.
Now the problem is watch App also has a complication, If an Apple Watch App has complication it stays in the background in order to launch the app quickly. So when will the iOS app sync the read only copy of userDefaults?
What can be the best practice to follow if a user wants to restore its settings every time the watch app extension is launched?
Standard set up for Watch OS > 2.
WCSessionDelegate used to coordinte data between main application and Watch.
An App Group "group.***********.TodayExtensionWidget" used to coordinate data between main application and its Today Extension widget via UserDefaults(suiteName: "group.***********.TodayExtensionWidget")
When I make a change from the watch it communicates that change with the main application. Then the main application (once launched) communicates this on to the Today Extension.
What I would like to do is communicate the change in the watch app to the Today extension without needing to launch the main app first.
Is there a best practice to communicate between a watch app and a Today Extension widget?
At the moment there is no way to achieve this using any built-in frameworks. Since the introduction of watchOS2, WatchKit apps are considered to be independent apps and not just an extension of the iOS app, hence you cannot use AppGroups to share data between the two and especially cannot use it to share data between the WatchKit app and an iOS extension.
As you already experienced, WatchConnectivity cannot be used in a Today extension, so that is out of the picture as well.
Your only option is a suboptimal one, since you will need to upload your data to a server from your watchOS app and download it in your iOS Today extension. This of course generates unnecessary data usage, but with the current frameworks provided by Apple you cannot share the data offline.
However, if you wait until watchOS4 is released (or give the beta version a try), you might be able to leverage the CoreBluetooth framework, which is becoming available for WatchKit in watchOS4 to communicate between a WatchKit app and an iOS extension offline, using BLE. I am not 100% sure if CoreBluetooth can be used in iOS Extensions, but you should give this a try if you can use watchOS4 beta.
Let's say we have running widget on iPhone and app on Apple Watch at the same time. How to inform Apple Watch that we have made any changes to the model with widget?
App Groups are not longer supported by Apple Watch so we can't use MMWormhole nor Realm to share database...
Widget does not support Watch Connectivity and I end up with outdated model
How to handle this situation when the main app is closed?
iOS10, watchOS3, Swift 3
MMWormhole apparently also supports the WatchConnectivity framework of watchOS 2, so you should still be able to use it to send data.
Unfortunately, according to this Apple Developer Forum thread (and this SO question), it is simply not possible to use WatchConnectivity from a Today extension. It will always be necessary to pass any data added by the Today Widget back up to the host app, and then have the host app pass the data to the watch.