CloudKit CKOperations do not complete when on cellular. When they do its once in a blue moon.I schedule things with allow cellular, and have verified in settings that iCloud allows cellular access. When I add any operation to the public database it will not do anything until I flip my device to wifi. This isn't acceptable as it is taking advantage of the location queries and is an on the go application.Has anyone come up with a workaround? Other posts suggest that it is a reported buy but has been around for a while so I'm not entirely sure.Edit:I have unit tests setup to do everything not only my application. When I run my unit tests with wifi off, they fail (30 second timeout without callback). After running them a few times with wifi (passing) and then switching they all of a sudden work on cellular (4 for 4 runs).I was able to run the app immediately after the successful cellular unit tests once. Its now back to failure.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm adding Weather info to my workout app. The documentation for HKMetadataKeyWeatherHumidity states that the unit is percentage humidity.
https://developer.apple.com/documentation/healthkit/hkmetadatakeyweatherhumidity
HKUnit.percent() has valid values from 0.0-1.0 inclusive.
https://developer.apple.com/documentation/healthkit/hkunit/1615517-percent
For a given humidity of 61% (i.e. 0.61 from my server), I'm saving the following quantity:
metadata[HKMetadataKeyWeatherHumidity] = HKQuantity(unit: .percent(), doubleValue: humidity)
builder.addMetadata(metadata) { }
The health app is interpreting this at 1% humidity (school kid rounding) 0.61 -- 1% and 0.41 -- 0%.
When I print the humidity quantity of a workout recorded by Fitness app on Apple Watch, I see the value as 6100 %. Meanwhile, quantity.doubleValue(for: .percent()) prints out 61.0.
Seems that the Health app is scaling by a factor of 100. Has anyone else integrated humidity into their HealthKit compatible app? How were you saving it to make sure it displayed correctly in the Health app. I'd hate to account for this, only to find out it is a bug and have apple change their logic in the app.
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
Health and Fitness
HealthKit
Apple Watch
Has anyone else discovered CoreLocations "NullIsland" print out?
I recently came across this easter-egg-esque message printed from my CLLocationManager in simulator and device (iOS 14.4.2) in some of my workout API code.
2021-04-10 08:30:11.547947-0500 AppName[28506:1222419] [Client] {"msg":"#NullIsland Either the latitude or longitude was exactly 0! That's highly unlikely", "latIsZero":0, "lonIsZero":0}
I was banking on CLLocationManagers caching/sharing the 'location' property and cheating a little not passing my 'lastLocation' data point from one area of code to another and just doing CLLocationManager().location. Oddly enough, when I am attached with a debugger and then PRINT that object via lldb po location, it is populated with non-zero lat/long.
I could refactor my code to pass the location property throughout my code, but if the value isn't really NullIsland, I'm not sure if it is worth the trouble.
Anyways, this message feels misleading because lat/log is non-zero. I would expect this message to be printed when returning NullIsland OR when returning nil itself.
Here is the gist - https://gist.github.com/edorphy/930dfbe73d4c471d4cd7a9668048b760
I submitted a feedback asking what would be safe prevent MITM attacks against CloudKit web APIs, pinning against the CA was an okay'd implementation.
This is the response I got in my feedback: FB9445034
You can pin to the various Apple CA or sub-CA certificates that can be found here:
https://www.apple.com/certificateauthority/public/
https://www.apple.com/certificateauthority/
All the certificates for CloudKit and iCloud web APIs have cert chains that point to the certificates listed.
I have followed this article Identity Pinning and modified my App Clip info.plist accordingly to pin against CloudKit Web Services (https://api.apple-cloudkit.com). I intentionally mucked up the identity pin to verify my URLSession requests failed. I didn't receive any URLSession errors in my App Clip or Application targets when I had the plist updates in both.
In reading these other forum posts I'm curious if the Identity Pinning is supported in App Clips or not.
https://developer.apple.com/forums/thread/678081
https://developer.apple.com/forums/thread/681734
Question: Do App Clips support receiving callbacks from ASWebAuthentictionSession's redirectCallbackURL?
Context: I'm trying to get CloudKit working in an app clip. Read support is done, but it would be nice for the user to see the capabilities before full download.
Presently, I have the CloudKit Web Services successfully invoking redirectURL within SafariViewController, but I haven't figured out how to get it to direct to something the App Clip can get a hold of.
CloudKit allows you to specify three different callbackURLs:
https:// [freeform]
http:// localhost[freeform]
cloudkit-icloud.:// [freeform]
I am new to AuthenticationSerivces framework so I may have missed something. The desired OAuth doesn't need to be CloudKit/iCloud but any provider.
Everything is working except the redirect URL.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
CloudKit
App Clips
Security
Authentication Services
I have a record type called ContactInformation that has phone and email as fields. This record type also has two references that point to different types. Namely type1 and type2 for illustration (one is a person reference, another is a place reference).
When I seed my application I do a blind query operation to get all records. I don't think there is a way to perform a query using a predicate where the field isn't nil but thought I'd pose the question to the forums.
The idea would be query where type1 != nil and then a second one where type2 != nil. Using CloudKit Console doesn't receive any results when running the following queries so I don't think this is supported as of today.
CloudKit Console provides the following error when a reference filter by is applied with empty value: invalid id string: empty
As a work around, I could create a 'dummy/default' reference id then the != "dummy identifier" would in theory work but it feels very hacky.
Has anyone found a more elegant solution than to use a dummy reference ID?
I filed this feedback requesting the ability to create a predicate that supports nil values: FB9833175
Hey developer community / CloudKit fans,
I'm making an application that utilizes CloudKit's identity system to provide my users a 'social' aspect of the app as well as their own identity. When filling out my App Privacy label, I'm torn if I should disclose Contact usage or not.
https://developer.apple.com/documentation/cloudkit/ckcontainer/1640421-discoverallidentities
Right now, I'm leaning to not specifying Contacts collection. Here are my thoughts:
Data Collection defined by Apple, paraphrased, is transmitting data off device for longer than needed for the request.
How Apple implements the function of the CloudKit identity lookup is outside of our control as developers, however, it is reasonable to expect that Apple would not save your contact address book in CloudKit and the data does not live in CloudKit longer than it needs to.
I don't access the Contacts app or API in the implementation.
Apple in fact use your contacts under the hood to service this request according to the documentation, however to the user, there is no contacts permission / access prompt for the application itself. The app doesn't get access to the full contacts db.
When you receive a CKUserIdentity, the contacts identifier is just that, a lookup identifier string.
I'm not going further than just displaying the information on the user identity. I could back link the identifier to a contacts record, but I don't need to. If I did that, even then I would say no, because the operation all happens locally on device.
Does your app use CKUserIdentities? How did you answer the App Privacy question for Contacts?
If you have strong feelings one way or another, I'd love to hear your perspective.
Topic:
App Store Distribution & Marketing
SubTopic:
General
Tags:
App Review
App Store
CloudKit
Privacy
I've noticed a bug in my app recently, it appears that in watchOS 8.5 (or earlier) that page layout is no longer initializing or awakingWithContext the pages beyond the first index.
According to the documentation:
In a page-based interface, all interface controllers are initialized up front but only the first one is displayed initially.
https://developer.apple.com/documentation/watchkit/wkinterfacecontroller/1619521-init
I am simply not seeing this happen anymore. I have logging in all of the lifecycle method of all three of my pages and the second and third controllers don't fire anything (including init) until I swipe to the right. This is when I would expect the willActivate and didActivate methods to be invoked. Instead I get init, awake, willActivate, and then didActivate. :/
This is unfortunate and a bug to the user because the second controller asks to becomeCurrent under some certain conditions that the first detects and fires via NotificationCenter. The automatic programatic switching between pages is totally broken.
FB9972047
Topic:
App & System Services
SubTopic:
Core OS
Tags:
watchOS
WatchKit
Health and Fitness
Accessibility
Xcode 14 beta 1 is yelling at me that CKNotification initializer should return a non-optional value. This happens only AFTER letting Xcode upgrade my project settings.
The change that the upgrade project settings made was it merged my WatchKit and WatchKit extension targets into a single watch app target.
After doing so, this code will not compile which I know to be good.
// This line fails to compile with '
if let notification = CKNotification(fromRemoteNotificationDictionary: userInfo) {
// Do something
}
Compile error: "Initializer for conditional binding must have Optional type, not 'CKNotification'"
Feedback w/ sysdiagnose:
FB10282805 - watchOS / CloudKit: CKNotification doesn't return optional, xcode build failing after updating project settings for Xcode 14
I could not reproduce this in a sample application. I tried making a standalone watch app with Xcode 13, upgrading the project file with Xcode 14 beta, and then creating a CKNotification object--but that worked fine. :/
Note: My app is in pre-order status for a version approved against Xcode 13.4.1, the below is for submitting an update with iOS/iPadOS 16 support using Xcode 14 RC released today.
Is this happening for anyone else?
I just downloaded Xcode 14 RC and archived/uploaded a build. When I select the build in App Store Connect to submit to review, it isn't showing my App Clip domains.
When I select a build that was created yesterday with Xcode 14 Beta 6 from Xcode Cloud, the domains show, but for obvious reasons (Xcode beta tools) I cannot submit that build.
I'm waiting for Xcode Cloud to add RC to their list and try again, but I'm stuck. I think it is just an App Store Connect issue, because my code is literally unchanged between these two builds less the build version. Furthermore, I inspected the archive locally from Xcode 14 RC and in the validation step, confirmed the entitlement lists my two appclips associated domains in both the app target and app clip target.
I created a feedback for this here: FB11471066, FB11335182
Has anyone else had this issue? I know that App Clips was having some issues a few weeks ago but this seems like something entirely different: https://developer.apple.com/forums/thread/712372
Finally, to the last of my ability to troubleshoot, running the Diagnostics under App Clips Testing in the Settings app, I get all green checkmarks for both of my domains--so I really just believe this to be a portal issue and that everything actually checks out.
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
App Review
App Store Connect
Xcode
App Clips
I've been getting duplicate visits sent to my CLLocationManagerDelegate. This is new since iOS 16, I did not see this behavior in iOS 15--the observed effect is a quite severe regression in the behavior of CoreLocation.
Here is what I'm seeing:
The visits have already been delivered
When they're sent 'again', they're sent in dozens of callbacks
When they're sent 'again', they're sent in batches irrespective of app state
I have had a debug app on my phone running since November to capture sysdiagnose for FB12107066. My app simply records data from CoreLocation into a mini Core Data table.
Since November 11th, I have had 3808 visits, but when I do some distinct queries on arrival and departure I get a fraction of that.
Select distinct arrivalDate: 929
Select distinct departureDate: 799
Select distinct arrivalDate + departureDate: 1172
I wrote some logic to attempt to deduplicate and filter out garbage visits that have already been delivered to me, but my filtering isn't bullet proof. This issue has been happening for me on multiple devices since Nov (iOS 16.2 days?).
This happens on an iPhone 13 Pro and an iPad Pro 11-inch (4th gen).
This is a real nasty bug as it also keeps waking my app up in the background when I don't expect it to since the OS is delivering me old / replay visits. :/
Has anyone else seen issue with the Core Location Visit API in iOS 16?
What deduplication and filtering logic did you come up with?
While the issue is affecting me via CoreLocation, I would suspect the same might also occur for anyone using the visits API in SensorKit too.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
Debugging
SensorKit
Core Location
Maps and Location
I've recently started working with IPS files, specifically crash reports. According to the documentation there are a number of metadata keys included in these payloads, however, I have found a number that are present in real ips files from device but are not documented.
Does anyone know what version of iOS these 'new' metadata keys were introduced? How about if they're expected or if I should treat them as optional.
https://developer.apple.com/documentation/xcode/interpreting-the-json-format-of-a-crash-report#IPS-metadata
{
"app_name":"ApplicationNameHere",
"timestamp":"2024-02-15 08:05:05.00 -0600",
"app_version":"1.6.0",
"slice_uuid":"6b1f9f4e-3025-364f-9847-914fc1fe14d1",
"build_version":"800",
"platform":2,
"bundleID":"reverse.domainname.bundleidentifier",
"share_with_app_devs":1,
"is_first_party":0,
"bug_type":"309",
"os_version":"iPhone OS 17.3.1 (21D61)",
"roots_installed":0,
"name":"ApplicationNameHere",
"incident_id":"1CF0B8A1-EB43-46B3-AA9F-CFA8A9259190"
}
The following keys are not in the documentation: app_name, os_version, slice_uuid, share_with_app_devs, is_first_party, roots_installed
I created this feedback to request the documentation be updated with current state.
FB13631161 - Developer Documentation: Update IPS metadata to reflect latest values found in IPS Metadata JSON
I'm trying to download artifacts from some recent Xcode Cloud builds. In both Xcode and App Store Connect I'm getting errors.
Xcode says: "Error Fetching Test Results: API Invalid status code: 501.
App Store Connect says: "artifacts could not be found."
FB13773789 - Xcode Cloud: Service returning 501 in Xcode when trying to view artifacts of successful build from minutes ago
I have tried several projects to rule out project specific issues and it is happening to all of my Xcode Cloud enabled projects. Both Xcode 15.3 and 15.4 beta exhibit this behavior.
Is anyone else running into this issue? I noticed it yesterday, and it continues into this morning.
I'm running into an error in Xcode 16 beta 4 where the compiler can't type check what appears to be a simple @FetchRequest.
I have the following Core Data types:
Establishment
name
website
etc.
locations (relationship, to many, optional)
Location
name
address
establishment (relationship, to one, non-optional)
In one of my SwiftUI views I have the following @FetchRequest and SortDescriptors. Unwrap required because 'core data' optional types. It looks based on the swift lang key-path expression docs that this should be allowed. Build and run works, but archiving does not. https://docs.swift.org/swift-book/documentation/the-swift-programming-language/expressions/#Key-Path-Expression
In practice it won't be nil and validation should prevent it too so I could force unwrap the relationship property, but, defensive coding I want to make it safe as I can.
@FetchRequest(
sortDescriptors: [
SortDescriptor(\Location.establishment?.name, order: .forward),
SortDescriptor(\Location.city, order: .forward),
SortDescriptor(\Location.state, order: .forward)
]
)
private var locations: FetchedResults<Location>
This worked fine with Xcode 15.x, but fails to archive in Xcode 16 beta 4.
The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
When I remove the first sort descriptor it works. When I force unwrap the optional key path property it works.
Does anyone know of a documented change that would make this no longer work?
FB14515958 - SwiftUI: SortDescriptor cannot archive in Xcode 16 beta 4 but works in Xcode 15.4
For clarity, this archives fine, note the force unwrap.
@FetchRequest(
sortDescriptors: [
SortDescriptor(\CraftTaproom.brewery!.name, order: .forward),
SortDescriptor(\CraftTaproom.city, order: .forward),
SortDescriptor(\CraftTaproom.state, order: .forward)
]
)
private var taprooms: FetchedResults<CraftTaproom>
Apple's sample code 'Trails' supports multiple scenes, however everything is using shared state across the scenes. Put the app in Split View mode and have two windows of the app running and navigate, you can see both mirror each other. Works as designed, it is using a shared 'navigation model' across all scenes.
https://developer.apple.com/documentation/appintents/acceleratingappinteractionswithappintents
I would like to know if there is a supported or recommended way to modify individual scene storage from within the perform body of an AppIntent. The objective is to have App Shortcuts that launch different tabs in a TabView or different selections in a List.
In short, I want to deep link to features, but account for more than one scene being open on iPad and only have programatic navigation happen on the scene that is 'foremost' or the 'activated' one in Split View.
I have it working with either a @Dependency or posting a Notification with my main ContentView listening to the other end, but it changes all scenes.
Topic:
Machine Learning & AI
SubTopic:
Apple Intelligence
Tags:
SwiftUI
App Intents
Apple Intelligence