I've got a notification service extension with quite a lot going on, and consequently I've been running out of memory.
One thing in particular that is using a lot of memory is UIGraphicsImageRenderer which I'm using to construct an image at run time the size of the device's bounds.
Running the extension in Xcode and profiling its memory it appears that using autoreleasepool {} doesn't seem to always release memory instantly, so if you do A and then B, and combined they have too much memory usage for the extension to handle, trying to autorelease A doesn't actually always release the memory before B (unlike if the code is running in the main app rather than an extension).
A few questions
is there any way of programmatically detecting the memory usage / memory limit within the extension?
if the extension goes over the 24Mg limit, is there any way of catching that exception and handling it somehow?
is there a way of ensuring/forcing autoreleasepool{} to clear memory before proceeding with further code?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
There's about 20 internal testers on our Testflight account, but a couple of them just never ever receive the invites/redemption codes so its impossible to get them set set up to be able to test the app.
They are added to the Internal Testing App Store Connect Users group, and I've also tried creating a new group and adding them to that as well as and instead of the App Store Connect Users group. These groups are added as testers of builds, and for the other 20 users their status says "Installed" but for a couple of testers their status always shows as "Invited Resend Invite".
The problem is, even if I click on Resend Invite an infinite number of times, these testers never receive anything. Never. Not after waiting an hour, 10 hours, a day, a week, a month. Click on click on click on Resend Invite and it does nothing, they never get anything.
No emails are not going into their trash/spam folder.
I've tried deleting the testers entirely from the entire developer account, and then when I re-add them back, then in that case they do get an email inviting them to join the developer account, but then they don't subsequently receive a TestFlight invite / code when added to a build.
The internal testers are all members of the same organization, so all have the same form of email address which is being used. 20 or 30 or them its ok, but for a couple of testers Testflight just hates them.
For one user, we tried everything and spent literally weeks, just was never ever able to get them set up and eventually had to give up. Our IT department had to specially create a new email for them, just to try and get them added to TestFlight. Hey and guess what, the new email worked, while the old one never did. But this isn't a solution, can't ask the IT dept to create new emails, and shouldn't have to.
But now the same thing is happening again to another tester.
Why does clicking Resend Invite not do anything? How can I force things and get this tester to receive an invite?
I want to use features described in the background assets WWDC22 session (https://developer.apple.com/videos/play/wwdc2022/110403/).
In earlier versions of Xcode 14 beta there used to be a background asset extension target type, however this got removed in beta 5 and has still not been put back even though Xcode 14 RC is released.
With Xcode 14 beta 4, if the background asset target was chosen then a bunch of template code was created, same as happens with any extension type.
But if the background asset extension target type isn't even present in the Xcode 14 RC, how is one supposed to create an extension and use this new feature?
If the code below is run it causes an exception
'NSInvalidArgumentException', reason: '-[__NSCFType set]: unrecognized selector sent to instance 0x283130be0'
However, the exception can be removed by reducing the width value from 100.0 in positionRect, for example setting it to something like 50.0 removes the exception.
But why is this? With a width value of 100.0 specified for positionRect, that's well short of the width of imageSize. And even if there is some size issue, why is there an unrecognized selector exception?
let imageSize = CGSize(width: 400, height: 100)
let testRenderer = UIGraphicsImageRenderer(size: imageSize)
let testImage = testRenderer.image { context in
context.cgContext.setFillColor(UIColor.black.cgColor)
context.fill(CGRect(origin: .zero, size: imageSize))
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = .left
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.systemFont(ofSize: 8.0),
.paragraphStyle: paragraphStyle,
.foregroundColor: UIColor.white.cgColor
]
let attributedString = NSAttributedString(string: "This is some text", attributes: attributes)
let positionRect = CGRect(x: 10, y: 10, width: 100.0, height: 8.0)
attributedString.draw(with: positionRect, options: .usesLineFragmentOrigin, context: nil)
}
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?
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?
This can easily be reproduced from scratch following these steps:
Launch Xcode and choose to create a new iOS app. Organization name: com.company, ProductName:experiments.
Therefore the bundle id is: com.company.experiments
Create a background download target, productName:backgroundDownloadExtension.
Therefore the bundle is is: com.company.experiments.backgroundDownloadExtension
When Xcode creates the extension it automatically gives it a group capability with id: group.com.company.experiements.
Within the signing & Capabilities section for the extension there is the following error:
Within the developer portal, go to the Identifiers section, locate the main app bundle com.company.experiements. If not ticked, tick the App Groups capability. Click on edit, select group.com.company.experiments
Within the developer portal Identifiers section, locate the extension bundle, com.company.experiments.backgroundDownloadExtension. Ensure the App Groups capability is ticked. Click on edit, select group.com.company.experiments.
Like so for both the app and extension:
Back in Xcode, for the app add the group capability, tick group.com.company.experiments. Now it matches the extension and will be like this for both of them:
Quit and relaunch Xcode because Xcode is so unbelievably sticky and seems to cache everything, e-v-e-r-y-t-h-i-n-g, and millions of problems can be solved just by quitting/relaunching it.
In the Signing & Capabilities section for the extension it still displays this:
Back in the developer portal, create a provisioning profile for iOS development, choose the com.company.experiments bundle id, download it.
Do likewise for the com.company.experiments.backgroundDownloadExtension
After downloading, click on them both.
Quit and re-lanch Xcode again. Any luck? No its still displaying the provisioning error.
Ok, enough of Xcode's automatic management of signing. Let's turn that off and import the the extension provisioning profile that was just downloaded. Still getting this error:
The entitlements file's contents are:
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.company.experiments</string>
</array>
The contents of the downloaded extension profile are:
<key>Entitlements</key>
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.company.experiments</string>
</array>
<key>application-identifier</key>
<string>MV8J9D3236.com.company.experiments.backgroundDownloadExtension</string>
<key>keychain-access-groups</key>
<array>
<string>MV8J9D3236.*</string>
<string>com.apple.token</string>
</array>
<key>get-task-allow</key>
<true/>
<key>com.apple.developer.team-identifier</key>
<string>MV8J9D3236</string>
</dict>
I give up, how the hell can you create a background download extension without Xcode displaying the error?
A few days ago I uploaded a build to Testflight successfully.
Just now I made absolutely no changes whatsoever other than to increment the build number. This latest build doesn't appear in Testflight.
Tell me this can't be anything other than a bug with Testflight, if a build from a few days was good enough to appear, then how come with no changes it no longer is.
Using the newly released Xcode 14 to upload an app to App Store Connect results in several warnings saying "The app references non-public selectors in ....."
This does not occur when uploading if the archive is built using Xcode 13
Is this a re-emergence of an Apple bug:
https://developer.apple.com/forums/thread/127678?answerId=715975022#715975022
Which has the response: "The issue has been resolved on the app validation backend. Please try resubmitting. Sorry for the trouble." Apple Developer Tools Engineer
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
iOS
App Store Connect
Xcode
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)
While attempting to upload my app to TestFlight (which has already been uploaded numerous times, including just a few days ago with the same code base) there is this error
"TMS-90338: Non-public API usage - The app references non-public selectors in : _isKeyDown, _modifiedInput, _modifierFlags....."
Nothing new there, that's been happening for months for myself and countless others and has been reported numerous times, i.e.
https://developer.apple.com/forums/thread/127678?answerId=715975022#715975022
https://developer.apple.com/forums/thread/714450
But now there's a difference - in the past the builds always appeared in Testflight after getting this warning, so it wasn't an issue.
But now that's changed, the build is no longer appearing in Testflight, so it suddenly is a very big issue.
This video is referenced in several places, for example here references it
https://developer.apple.com/documentation/callkit/making_and_receiving_voip_calls_with_callkit
and Eskimo has referenced it in his posts. But its gone, there are other WWDC16 session videos but not this one (https://developer.apple.com/videos/wwdc2016)
Is it available anywhere else?
Also how can this code be run/tested for an incoming call (without using the build in simulator i.e. using a real incoming Voip call)? What tool/app etc. could be used to generate a call to the handset to see the code in action when answering a VoIP call?
I'm trying to fire a timer in a notification service extension, but what would work in the app doesn't work in the extension i.e.
Timer.scheduledTimer(timeInterval: 8.0, target: self, selector: #selector(doSomeStuff2), userInfo: nil, repeats: false)
or
Timer.scheduledTimer(withTimeInterval: 7.0, repeats: false) { timer in
...
}
and so on, etc.
Is that a way of getting a timer to fire in an extension?
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
I've added a background asset extension and am trying to invoke it using this:
xcrun backgroundassets-debug --app-bundle-id com.myCompany.myApp --device-id 00008120-000225060C9B401E --simulate --app-update
When I run that command I see this in the phone's log:
Unable to observe extension for (com.cequint.myapp), the BAApplicationInfo is missing an extensionIdentity.
So how should an extension identify be added?
The extension's info.plist is as created by the Xcode template:
<key>EXAppExtensionAttributes</key>
<dict>
<key>EXExtensionPointIdentifier</key>
<string>com.apple.background-asset-downloader-extension</string>
</dict>
And I've added the following to the app's info.plist:
> <dict>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>kBackgroundTaskIdIdentifier_RNScheduleAppRunEvent</string>
</array>
<key>BAMaxInstallSize</key>
<integer>3221225472</integer>
<key>BAInitialDownloadRestrictions</key>
<dict>
<key>BADownloadDomainAllowList</key>
<array>
<string>*.drive.google.com</string>
</array>
<key>BADownloadAllowance</key>
<integer>2147483648</integer>
</dict>
<key>BAManifestURL</key>
<string>https://drive.google.com/file/d/1doJtzxBKCoVHEF80sndK6VskCrkD9H9r/view?usp=sharing</string>
What else needs doing to provide the extension identifier the OS is saying is missing?
(Using Xcode 14.1 and iOS 16.2)