Posts

Post not yet marked as solved
0 Replies
684 Views
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. :/
Posted
by edorphy.
Last updated
.
Post not yet marked as solved
0 Replies
1.1k Views
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.
Posted
by edorphy.
Last updated
.
Post not yet marked as solved
0 Replies
834 Views
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
Posted
by edorphy.
Last updated
.
Post not yet marked as solved
1 Replies
1.9k Views
In my application initializer, I set a property on ApplicationDelegate. It is a reference to my data controller that manages access to many things (core data model). It gets passed in there to handle launch keys and pushes, and is relied upon as a required dependency to many services--namely push, navigation actions (quick look, Siri intents, etc.). In summary, I want to clean up and move some initialization code from my application initializer (tons of compiler directives for multi targets, watch, app, etc.) to the respective application delegates. BUT this requires an assumption that didFinishLaunching will be called after a property is injected into app delegate. Is this a safe assumption to make? I have observed the didFinishLaunching getting invoked only AFTER the initializer of Application completes. Can this be relied upon in terms of dependency injection? Can this order be assumed? Application init Property assignment on app delegate within app init App delegate init Property is set (didSet fires) App initialization complete, return Delegate fires willFinishLaunching Delegate fires didFinishLaunching Other delegate methods fire accordingly I assume that the implementation of UIApplicationDelegateAdaptor under the hood is similar to the Coordinators in UIViewRepresentable where as soon as you try to access / assign something on it, then it constructs the object and assigns an instance to the property wrapper. Additionally, if it hadn't already been initialized, because it DOES need to call delegate callbacks, the system will invoke it had you not already assigned a property to initialize it.
Posted
by edorphy.
Last updated
.
Post not yet marked as solved
1 Replies
1.3k Views
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
Posted
by edorphy.
Last updated
.
Post not yet marked as solved
0 Replies
509 Views
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
Posted
by edorphy.
Last updated
.
Post not yet marked as solved
4 Replies
1.9k Views
I'm building an app based entirely on CloudKit and I'm super excited for technologies like App Clip to make a mini 'menu' version of said app. The main app target allows vendor/site location managers to update their menu in real time and then signed in iCloud users can subscribe to those public record updates. I just discovered in the technology limitations of App Clips that CloudKit is out. It isn't in the list of 'supported capabilities' in the project editor. Additionally, as one would expect, trying to create a CKContainer without the entitlement in the App Clip target crashes with a fatal error due to the lack of that very entitlement. This feels unnecessarily restrictive and excludes developers from supporting App Clips who build their server tech stack on CloudKit. Write capability isn't needed for my concept. Effectively I'd want for each unique venue to be able to continue to manager their menu/venue via CloudKit + Security Roles and allow updating content in the main app--and for users to view/browse with focused location/venue specific menus in the app clip. As recommended, the full app has to be installed for the full experience. I'd rather not attempt to hit the public database via the JS library, or making an API proxy that just invokes CloudKit web tech under the hood. I really think supporting read operations from the public CloudKit database would enable many experiences that are currently restricted due to this limitation. If someone at Apple is watching, I created FB8528010 feature request with a little more details on my new feature concept.
Posted
by edorphy.
Last updated
.
Post not yet marked as solved
1 Replies
809 Views
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.
Posted
by edorphy.
Last updated
.
Post marked as solved
2 Replies
1.3k Views
My application makes use of opaque navigation and tab bars in its layout. I also use modally presented nav bar controllers using the card style introduced in iOS 13. Everything looks clean and as expected when running the app compiled from Xcode 12 (Test Flight or App Store). When I run my project using Xcode 13, I'm getting really strange rendering behavior of the bars. In light appearance, they're black instead of opaque white in some cases. In another case, when I have a MKMapView filling the entirety of my view, the tab bar is totally invisible and there are just the blue tab bar items floating on top of the map. I have attached images of three different scenarios that visually render as expected on Xcode 12, but fail horribly when deployed via Xcode 13. Opaque Tab Bar w/ nav controller Opaque Tab Bar w/ map view inside view controller Opaque Tab Bar w/ Opaque Navigation Bar presented modally as card. I was able to produce these issues using both SwiftUI and UIKit via Storyboards I've filed two feedbacks with Apple and sent them a sample project. If anyone else is encountering this issue feel free to mention feedback in yours to upvote the issue. FB9611443 FB9207757 Hope this gets fixed before RC so I can send an app update in making use of new features!
Posted
by edorphy.
Last updated
.
Post not yet marked as solved
1 Replies
1.4k Views
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
Posted
by edorphy.
Last updated
.
Post not yet marked as solved
0 Replies
594 Views
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.
Posted
by edorphy.
Last updated
.
Post marked as solved
3 Replies
3.3k Views
iOS 13 is requesting Bluetooth permission immediately upon central manager initialization. From the Bluetooth 2019 talk, the presenter illustrated in the didUpdateState method to check the authorization state and appropriately prompt the user (presumably the same way you would with CMPedometer--invoke a instance method). Is this behavior to expected in the GM seed? It is counter intuitive and doesn't conform to the pattern that other frameworks use for their authorization workflow.This permission model seems to be incorrect, most other frameworks have a static method on the corresponding class to get authorization status. For example https://developer.apple.com/documentation/corelocation/cllocationmanager/1423523-authorizationstatus, https://developer.apple.com/documentation/coremotion/cmpedometer/2913743-authorizationstatus. The API signature that has a "notRequested" state, will seemingly never be the case since the prompt happens upon first initialization NOT first usage. CMPedometer initialization does not initiate the privacy prompt, only calling a method to do work does. CLLocationManager has explicit methods to invoke the authorization modal.If we don't have the class func to check authorization, and are dependent on an instance of CBCentralManager to have been initialized with a delegate, we can't design an elegant workflow to prompt the user at the appropriate time.
Posted
by edorphy.
Last updated
.
Post not yet marked as solved
6 Replies
1.5k Views
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.
Posted
by edorphy.
Last updated
.
Post not yet marked as solved
0 Replies
582 Views
Anyone else having issues with Mac Catalyst app submissions? My validation is failing with an error about an iOS provisioning profile not being valid for the app; my iOS version of this app has been uploaded successfully and was distributed via TestFlight already. Even an empty/blank project with Catalyst checked does not work. This is with Xcode 12.2 RC, with an upgrade to Big Sur 11.0.1. Steps: Create new project Rename bundle identifier to match listing in App Store Connect Enable the catalyst checkbox in the iOS target settings Add app icons to satisfy upload Specify app category to satisfy upload Specify app bundle name to satisfy upload Archive with “My Mac” or “Any Mac” selected Attempt to validate this archive and expect success In the organizer log I get the following error message when attempting the above: "App Store Connect Operation Error Unable to process application at this time due to the following error: Invalid Provisioning Profile. This provisioning profile is not compatible with iOS apps.." This app is intended to be a universal bundle identifier and it is set to the identifier that I have successfully uploaded builds to App Store Connect for iOS and released to Test Flight. I checked the configuration of the XC automatic identifier on the developer account page and everything looked fine there. I created Feedback FB8894428 for this.
Posted
by edorphy.
Last updated
.
Post not yet marked as solved
1 Replies
938 Views
I'm unable to find any documentation on how to use atos given the content within an MXCrashDiagnostic's json representation but I think I have worked through most of it. From this documentation here - https://developer.apple.com/documentation/xcode/diagnosing_issues_using_crash_reports_and_device_logs/adding_identifiable_symbol_names_to_a_crash_report I have identified that this is the atos command I'm looking for. % atos -arch <BinaryArchitecture> -o <PathToDSYMFile>/Contents/Resources/DWARF/<BinaryName> -l <LoadAddress> <AddressesToSymbolicate> Using the following from my app AppNameHere this is what I extracted: platformArchitecture (arm64e) from the diagnostic's metadata Load Address (offset) 0x4332388352 Address 0x4332421432 UUID ACF5E4F6-EDD8-36C3-A650-58C53D4D66A7 [ &#9;{ &#9;&#9;"binaryUUID": "432C7D54-5315-3EC7-A3BE-A48E873736A7", &#9;&#9;"offsetIntoBinaryTextSegment": 6762471424, &#9;&#9;"sampleCount": 1, &#9;&#9;"subFrames": [ &#9;&#9;&#9;{ &#9;&#9;&#9;&#9;"binaryUUID": "ACF5E4F6-EDD8-36C3-A650-58C53D4D66A7", &#9;&#9;&#9;&#9;"offsetIntoBinaryTextSegment": 4332388352, &#9;&#9;&#9;&#9;"sampleCount": 1, &#9;&#9;&#9;&#9;"subFrames": [ &#9;&#9;&#9;&#9;&#9;{ &#9;&#9;&#9;&#9;&#9;&#9;"binaryUUID": "9B2D02A4-C9C0-3CAF-BBD2-C1BCEE117E8E", &#9;&#9;&#9;&#9;&#9;&#9;"offsetIntoBinaryTextSegment": 6727446528, &#9;&#9;&#9;&#9;&#9;&#9;"sampleCount": 1, &#9;&#9;&#9;&#9;&#9;&#9;"binaryName": "libdyld.dylib", &#9;&#9;&#9;&#9;&#9;&#9;"address": 6727450176 &#9;&#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;], &#9;&#9;&#9;&#9;"binaryName": "AppNameHere", &#9;&#9;&#9;&#9;"address": 4332421432 &#9;&#9;&#9;} &#9;&#9;], &#9;&#9;"binaryName": "UIKitCore", &#9;&#9;"address": 6774548544 &#9;} ] I did not have a .dSYM file with this UUID, but after I went to Xcode Organizer and downloaded bitcode generated symbols I had a .dSYM that matched this UUID. So finally this is the command I created: atos -arch arm64 -o acf5e4f6-edd8-36c3-a650-58c53d4d66a7.dSYM/Contents/Resources/DWARF/AppNameHere -l 0x4332388352 0x0000004332909892 Trial by fire, the numbers in the dump are decimal, you need to convert them to hex. The documentation doesn't specify the format of the 'address' of 'offset'. edorphy$ atos -arch arm64 -o acf5e4f6-edd8-36c3-a650-58c53d4d66a7.dSYM/Contents/Resources/DWARF/AppNameHere -l 1023B0000 10242F544 atos[84639]: respawning is disabled (because DYLD_ROOT_PATH or DT_NO_RESPAWN is set), but the analysis process does not match the SDK variant of the target process 0. Analysis of malloc zones may fail. AppDelegate.initializeApplication(application:) (in AppNameHere) (UserAgreementManager.swift:37) Does anyone know how to get rid of the respawning message, or is that expected? I noticed that the arch is arm64e in the report, but the dwarfdump of the .dSYM says just arm64. It seemed to make no difference specifying with the 'e' or not.
Posted
by edorphy.
Last updated
.