Post

Replies

Boosts

Views

Activity

CloudKit operations using publicDatabase queue unreliable
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.
6
0
1.5k
Oct ’15
iOS Dark Mode UINavigationBar not updating background color
I figured that I'd get the support for Dark Mode out of the box with UINavigationBar since I use the default opaque color scheme.I've noticed that when I switch the dark mode setting to ON either from environment in xcode, or command center with the screen brightness shortcut, my UINavigationController navbar background stays white but the title text color does change to the dark mode title color, white. White text on white background. I verified that the label is still there and still white using the Debug View Heirarchy within xcode.Sometimes, when I rotate then to landscape, the background will update to dark mode color. It isn't consistent. Same goes for the inverse, changing dark to light mode. Dark text on Dark background color.From a user's perspective, after a swipe-kill and relaunch, the color matches the themes in all orientations and navigation bars.I have my nav bars set to opaque from storyboard. Is there something else I'm missing that needs to be done? I didn't see anything in the adopting dark mode video from WWDC 19.Updated Aug 26, 2019I'm still seeing this behavior in dev beta 8. Created a bug report--hopefully this gets fixed. FB7134275Is anyone else affected by this? Basic app layout similar to either Phone or Clock app.UITabBarController (opaque bottom bar) - UINavigationController (opaque top bar) - UIViewController UINavigationController (opaque top bar) - UITableViewControllerThis is really non-functional because the title color is changed, but the bar color is not changing.Update Jan 6, 2020iOS 13.3 no longer seems to have this issue. I'm not sure in which earlier update this was addressed.
8
1
12k
Jul ’19
Bluetooth privacy usage prompt displayed immediately upon initialization of CBManager classes
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.
3
0
3.4k
Jul ’19
CBCentralManager is presenting the PowerAlert on initialization when options are not presented.
iOS 13 Beta 4, iPhone Xs.I'm seeing the power alert show even though the options are not specified. I have created a feedback/radar for this: FB6810811If this is the new behavior to expect for GM, the default init documentation should be updated accordingly. Seems like a bug to me as there is a second initializer to explicitly invoke this behavior.import UIKit import CoreBluetooth class ViewController: UIViewController { let centralManager: CBCentralManager = CBCentralManager(delegate: nil, queue: .main) }
1
0
673
Jul ’19
New advertisement key CBAdvDataTimestamp?
I discovered tonight in iOS 13 beta 8 that there is a new key and value in the advertisement payload. I didn't notice it before and it very well may have been there prior.The key is visible when printing out the advertisementData dict, and a typecast passes as TimeInterval if let timespan = advertisementData["kCBAdvDataTimestamp"] as? TimeInterval { print("Adv date intv \(timespan)") }I didn't see this documented in the API reference under new or old keys. Is this going to be in production? Android API captures timestamp of adv packet since boot--it would be nice to have something similar on iOS (point of reference can be epoch).These are the values that it was decoding as:Adv date intv 588221792.199425Adv date intv 588221793.25799Adv date intv 588221794.237889Adv date intv 588221795.255606Adv date intv 588221796.249666Adv date intv 588221797.243745They're nothing close to the epoch or seconds since boot. I got this out of the payload on my polar HR7.["kCBAdvDataManufacturerData": <6b000900 0000>, "kCBAdvDataTimestamp": 588222227.821503, "kCBAdvDataServiceUUIDs": <__NSArrayM 0x280657cf0>(Heart Rate), "kCBAdvDataLocalName": Polar H7 --------, "kCBAdvDataIsConnectable": 1, "kCBAdvDataTxPowerLevel": 0]
2
0
3.1k
Aug ’19
How long are HKQuantitySamples available on Apple Watch?
In my application I query data to compose a "Calorie Profile" for computing BMR and active calories during a workout.Several users have reported, in addition to having been seen in development, that .height and .bodyMass quantity samples are not found when queried on Apple Watch, but exist when queried on the paired/associated iPhone.How long is data made available on the Apple Watch?More specifically, I have a height sample saved on Oct 31st 2019 that is visible in the Health App, and queryable on my app on iPhone. This same sample quantity is not returned on the watch. I'm executing a simple unbounded sample query.For sanity checking, I just saved a new height sample (today) and refreshed the watch app. Less than 5 seconds later, the data was available. Next test was to delete the new sample, so the previous sample was then Oct 31st again. The query returned nothing again.extension HKHealthStore { public func mostRecentHeight(completion: @escaping ((Result<measurement, Error>) -> ())) { self.execute(HKSampleQuery.lastSample(for: .height, completion: { (height, error) in guard let heightQuantity = height else { completion(.failure(QueryError.nilError)) return } let height: Measurement = Measurement(value: heightQuantity.quantity.doubleValue(for: .meter()), unit: .meters) .converted(to: .feet) // TODO: Convert to preferred unit type completion(.success(height)) })) } } private extension HKSampleQuery { static func lastSample(for type: HKQuantityTypeIdentifier, completion: @escaping (HKQuantitySample?, Error?) -> ()) -> HKSampleQuery { guard let sampleType = HKObjectType.quantityType(forIdentifier: type) else { fatalError("Unknown sample type \(type)") } let sortDescriptor: NSSortDescriptor = NSSortDescriptor(key: HKSampleSortIdentifierStartDate, ascending: false) return HKSampleQuery(sampleType: sampleType, predicate: nil, limit: 1, sortDescriptors: [sortDescriptor], resultsHandler: { (query, samples, error) in completion(samples?.first as? HKQuantitySample, error) }) } }
0
0
474
Jan ’20
App Clips should support CloudKit for read-only access to the public database
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.
4
0
1.9k
Aug ’20
SKProductRequest delegate failure with undocumented AMSErrorDomain error
When testing In-App Purchase SKProductRequest with WiFi off and no cellular, the failure delegate method gets invoked as one would expect. Unexpectedly, this happens with an undocumented error domain and codes (AMSErrorDomain). Does anyone know where to find public documentation on the AMSErrorDomain? extension Store: SKProductsRequestDelegate {     func request(_ request: SKRequest, didFailWithError error: Error) {         if let storeError = error as? SKError {             os_log("Failed to load products with store kit error: %@", "\(storeError)")         } else {             os_log("Failed to load products with other error: %@", "\(error)")         }     } ... } (lldb) po error Error Domain=AMSErrorDomain Code=203 "Bag Load Failed" UserInfo={NSLocalizedFailureReason=Unable to retrieve p2-product-offers-batch-limit because we failed to load the bag., NSLocalizedDescription=Bag Load Failed, NSUnderlyingError=0x6000004707b0 {Error Domain=AMSErrorDomain Code=206 "Bag Load Failed" UserInfo={NSLocalizedDescription=Bag Load Failed, NSLocalizedFailureReason=Unable to connect to internet.}}} Clearly the underlying localized failure reason makes sense and is user friendly, however the error objects standard localized description 'bag load failed' is far from user friendly and isn't really acceptable to me to put in front of the user. Apple's very own InAppPurchase sample code just pumps the error localizedDescription into a UIAlertController message--but this can be done better! Title: 'Product Request Status', Message: 'Bag Load Failed' How are others handling failures in the SKProductRequest for non-SKError errors?
0
0
872
Sep ’20
New always-on altimeter should expose historical altitude data to developers
So the new Apple Watch Series 6 and SE models tout an always-on altimeter to give more real-time data to users. I develop a fitness application and see many use cases where having access to 'historical altitude data' would be great! I added elevation gain/loss in a feature update earlier this year and used the HKMetadata keys to attribute my workout and segments with that elevation data. Access to historical elevation would enable a ton of new features for developers. Preemptively, I have already created a Feedback item outlining my main use case but in summary, but the gist is that I suggested an API on CMAltimeter to be able to query that historical data the same way as on the CMPedometer class. Reference: https://developer.apple.com/documentation/coremotion/cmpedometer/1613946-querypedometerdata From that, this is my proposed API: public extension CMAltimeter { 		func queryAltimeterData(from: Date, to: Date, withHandler: @escaping CMAltimeterHandler) { } } The new consumer feature wasn't advertised as 'always-on and always recording to a file', but under the hood it might already be doing this, or could be doing this. If you have other ideas and are willing to share in here great. Otherwise submit your feedback, feel free to reference my Feedback item if you're also interested in a new historical query for Apple Watch (or iPhone/iPad too). FB8715215
0
0
1.1k
Sep ’20
Xcode 12.1 takes over a minute to launch app and attach debugger to iPhone XS running iOS 14.1
I upgraded my gear to the public releases for Xcode 12.1 and iOS 14.1 this week. After the upgrades, now whenever I select my iPhone Xs as my run target destination and run ANY project, it takes over a minute to launch my app and attach the debugger to it. I use OSLog directly in didFinishLaunching as my benchmark for launch time as well as the time graph when viewing the energy tab. The behavior is that springboard will launch to my launch storyboard, but then sit there waiting for over a minute before my console statements finally start going, the screen renders to my first view, and the debugger attaches. The strange part is that I can see the energy diagnostics attaching to the phone and it is around the 1:20 mark that things connect and the app finally runs. Also of note, I saw the phone transition to the "serious" thermal state while playing this waiting game a few times in a row so something appears to be thinking real hard. This does NOT happen on my iPad Pro running 14.1, nor my iPhone SE 2020 running 14.0--seems isolated to my Xs with 14.1 public release. Has anyone else experienced similar issues? I created FB8818402 for this issue
1
0
794
Oct ’20
App Group file not available in Widget Extension after successful save and widget timeline reload from app target
I have an app that uses an App Group to share data (images) between my main app target and my widget extension. I could load my widget image reliably prior to iOS 14.1 but things seem to not be working lately. The following is my helper to get a reference to the container in both my app and widget target, my static string matches the group in both entitlement files: let directory = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: .widgetGroupIdentifier)! Has anyone else had issues lately using AppGroups and widgets to share data from app to widget? My procedure is as such: Generate Image Save to container directory Reload widget timeline Separately in Widget Extension with debugger attached, wait for getTimeline to fire Read contents of directory, the file is not listed there!
0
0
618
Oct ’20
How to use atos given MXCallStackTree output?
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.
1
0
954
Nov ’20
Mac Catalyst: New project fails to successfully validate in Xcode Organizer
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.
0
0
602
Nov ’20
HKMetadataKeyWeatherHumidity quantity unit incorrect
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.
0
0
604
Apr ’21
I have found NullIsland - Simulator
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
1
0
1.4k
Apr ’21