Post

Replies

Boosts

Views

Activity

Notification Service Extension doesn't free memory between invocations
I've got a notification service extension which uses quite a lot of memory when it runs. Its using UIGraphicsImageRenderer:image() to create an image based on the push payload, and that that is a very memory hungry function. When the extension receives a push it uses less than the 25MB memory limit for extensions and its successful and runs to completion. However the next push that gets receives crashes due to memory not being freed (it doesn't matter if several minutes elapses between pushes). After its crashed its successful once more (the action of it crashing must obviously be freeing up the memory, so after a crash there's enough memory to run again, but then the next push after that will crash and so on and so on). I've run the extension interactively in Xcode's debugger to observe this behavior, but it also happens when running independently of Xcode (and thus lifetimes of things aren't being kept alive by the Xcode debugger). As my extension has no control over the creation/destruction lifecycle of UNNotificationServiceExtension, is there anything that can be done to force the OS/UNNotificationServiceExtension to fully unload and release all its resources?
0
0
801
Jan ’23
How should you programatically add a contact so it remains only on the device and isn't synched to iCloud?
I want to programmatically add a contact, preferably within its own group, such that it remains only on the (iPhone) device local copy of contacts and doesn't get synched elsewhere. However if I programmatically create a group then the group itself appears in iCloud, so presumably contacts within it will to. What sort of arrangement of containers/groups/contacts etc. should I create to achieve this?
0
0
1.3k
Jan ’23
What size image should be added to a contact such that it appears in full screen mode on the incoming call screen?
I'm programmatically adding a contact with an image with the intention the image should display in full screen size when a caller matching the number of the contact calls (as opposed to the image appearing as a tiny round icon next to the caller name). I'm creating an image of the same size and scale factor as the iPhone, and so far its working out ok - I have about 15 different phones, of various dimensions and scale factors, ranging from an old iPhone mini up to the most recent iPhone Pro Max, and on all of these it works as intended. But there's an exception, an iPhone 12 Pro (which has dimensions 390 * 844 and scale factor 3), on this phone when there is a call the contact image appears as a tiny icon. Why. Why is this phone different? How can I know what size image should be added to a contact to appear at full size in the call screen when every phone has different dimensions and they are not behaving the same? Additional question - the iPhone applies some cropping and expansion to whatever image gets added, is it possible to know what's being done to the image in order to make it display perfectly? (i.e. if the image contains some text, the fact the OS crops away some of the edge of the image, then expands what's left to fill the screen dimensions results in some pixelation)
0
0
618
Feb ’23
Xcode 14.3 fails creating an archive if it contains a pod
This takes 2 minutes to recreate: Create a new project in XCode Run pod init to create a pod file Add some pod to the pod file, I tried with MMWormhole or PhoneNumberKit or Realm Run pod install The app can be built however an archive cannot, it generates an error: rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9] Switch to Xcode 14.2 however and the archive can be built
0
0
615
Apr ’23
How does Robokiller deep link into Settings, are they using a private URL scheme?
An app can legally link into its own section of the Settings app, and if it uses CallKit, it can link into the Call Blocking & Identification section. Linking anywhere else into Settings is making use of private URL schemes and is supposed to not be permitted and the app rejected during submission. However the Robokiller app deep links into the Settings app with the page scrolled down to where the Phone section is. How are they doing that? Is there some new API that permits the app to link to there? Or are they making illegal use of private URIs and have been getting away with getting past App Store review for years?
0
0
359
Apr ’23
How have I been able to make Ad-hod builds/upload to App Store Connect without a distribution certificate
I intentionally deleted iOS development/distribution related certificates from my keychain (Login, Local Items, System, System Roots). Then built my app in Xcode. Automatically manage signing is turned on and Xcode created/installed an Apple Development certificate to my keychain). But if I create an archive, I am able to successfully create a development distribution, an ad-hoc distribution, and even upload to App Store Connect. Yet I don't have a distribution certificate anywhere in my keychain. I therefore don't understand how this was possible. How could I create all those distributions without a distribution certificate in the keychain?
0
0
336
Apr ’23
Read only container error attempting to create a contact group
Without exception, every single code example/tutorial for adding a contact group uses a nil container value i.e. the toContainerWithIdentifier parameter is nil, as below. I've not been able to find an example usage where it isn't nil. let group = CNMutableGroup() group.name = "whatever" let saveRequest = CNSaveRequest() saveRequest.add(group, toContainerWithIdentifier: nil) do { try store.execute(saveRequest) } catch { handle error } I've been running this code and 99.9% of the time it works as expected. However on one handset the catch is being executed with Error Domain=CNErrorDomain Code=207 "Container is read-only" How should I deal with this? How can I find out what container it is being added to? Why would it be read only? If nil means add to the default container, why is the default container in this case read only? How can I change the code that it will always run on every device? I've not been able to find any examples/tutorials for creating a custom container to which the group can be added.
0
0
754
May ’23
lipo command doesn't work with .xcframeworks
In the past I've used lipo to remove unwanted architectures from fat frameworks, using lipo -remove. However when attempting to do similarly with a .xcframework I keep getting errors, its not just the -remove command. If for example I run lipo -info someFramework.xcframework then the error is: can't map input file: someFramework.xcframework (Invalid argument) if I cd into the xcframework and run lipo -remove ios-arm64_x86_64-simulator then the error is unknown architecture specification flag: ios-arm64_x86_64-simulator in specifying remove operation: -remove ios-arm64_x86_64-simulator
0
0
851
May ’23
Xcode 15 - Can't launch console for iPhone
With Xcode 15 if you attach an iPhone (with iOS 17 installed) and then select Window|Devices & Simulators, then you can see the connected iPhone of the left hand side of the organizer. However with the iPhone selected, when the Open Console button is clicked it doesn't launch the console for the phone but instead for the Mac. There's therefore no way to view the handset logs (you can see the app logs within Xcode as per usual, but you can't view the holistic handset logs).
0
0
630
Jun ’23
Why does Xcode 15 Beta not have a 17.0 folder in DeviceSupport?
The Xcode 15 beta does not have a 17.* folder within Developer/Platforms/iPhoneOS.platform/DeviceSupport. How therefore does it build/install/run on a a phone with iOS 17 installed? Is there a different mechanism for device support used from 17 onwards than has historically been the case? I want to build/run using Xcode 14.n with an iOS 17 phone, but without being able to locate the iOS 17 support file am unable to do so. Where is the iOS 17 device support files with Xcode 15? How can I build using Xcode 14 for iOS 17 if its not present in Xcode15 (in order to drag and drop it into Xcode 14)
0
2
916
Jun ’23
Unable to retrieve contacts from a linked Exchange account
On my iPhone, in Settings, I've added my company Exchange account. Consequently, within the Contacts app, 4 new lists appear - the bottom as shown in the attached image. There's a few thousand contacts in the Company Exchange account, so why are the count values showing as 0? If I click on the Global Address list and search, it can succfully find whatever I search for. I want to programatically retrieve the contacts within the Exchange account, in addition to those stored locally or within iCloud, however if I execute the following code, for the container of type exchange, the count of results of the call to unifiedContacts() is 0. How can I programatically get the Exchange contacts? If the call to unifiedContacts() is resulting in 0 because the count for the lists when viewing the Contacts app is 0, then how to make it not 0 in the Contacts app (but if that were the case, how come manually searching for a contact is successful?) let keysToFetch = [ CNContactFormatter.descriptorForRequiredKeys(for: .fullName), CNContactPhoneNumbersKey, CNContactEmailAddressesKey, CNContactThumbnailImageDataKey] as [Any] var allContainers: [CNContainer] = [] do { allContainers = try CNContactStore().containers(matching: nil) } catch { print("Error fetching containers") } var results: [CNContact] = [] for container in allContainers { let type = container.type let identifier = container.identifier let fetchPredicate = CNContact.predicateForContactsInContainer(withIdentifier: container.identifier) do { let containerResults = try CNContactStore().unifiedContacts(matching: fetchPredicate, keysToFetch: keysToFetch as! [CNKeyDescriptor]) let count = containerResults.count results.append(contentsOf: containerResults) } catch { print("Error fetching containers") } }
0
0
661
Jul ’23
Any logging library that can enable a shared log file between the app and app extensions?
My app has several app extensions and I'd like to be able to unify the logging between them such that they write to a single shared file (which can be read from and subsequently uploaded to things like Crashltyics or Bugsnag etc.) Its possible to log directly to things like Crashlytics, however none of them I've investigated have a unified approach for the app and extensions (for example, if you use Crashlytics you have to configure the app and the extensions separately, so any logging goes to two entirely separate consoles.) Hence, instead I'm wondering if there a library that provides the ability to log to a file, and that file can be shared and simultaneously written to (in the case where the app and its extensions are running simultaneously). Do any of the existing log libraries for iOS have this ability?
0
0
385
Jul ’23