Post

Replies

Boosts

Views

Activity

Is it safe to access the contents of an app's bundle from within an app extension?
I've got some materials in an app's bundle (some info.plist values, and some images in .xcassets files etc.) If I access them from within an app extension (a notification service extension, notification content extension for example), then it appears to work. However while running the extensions in the debugger, there were some messages in the console saying the app bundle wasn't loaded. So despite it working, this message made me wonder if its not a safe practice and it working was luck and/or timing etc. and if the materials should instead be duplicated within the extension bundle and obtained from there instead of accessing them from the app bundle?
2
0
483
Jan ’25
Is there a way of specifying unicode characters for the BUNDLE_DISPLAY_NAME in an .xcconfig?
The BUNDLE_DISPLAY_NAME of my app changes (between Testing, Staging, Production) so that it's obvious to testers etc. which varian they are using. The name contains unicode space to ensure the OS doesn't apply kerning to the spacing within the app name. If this is put directly into the info.plist then on the iPhone desktop it's displayed as desired i.e. if the info.plist contains My Application Name Then on the iPhone desktop it displays as: My Application Name However if the name is defined in an .xcconfig file as BUNDLE_DISPLAY_NAME = Xfinity Call Guard And the info.plist contains $(BUNDLE_DISPLAY_NAME) Then the name is displayed on the iPhone desktop as My Application N.... Is there a way to specify the name with the unicode characters within an .xcconfig and get that to appear as spaces on the desktop?
2
0
403
Jan ’25
OS Logging says developer mode is disabled but its enabled
I'm trying to diagnose an issue with a Message Filtering Extension not working. The associated domain for the server is not currently publicly hosted, so the associated domains specified for the app are postpended with ?mode=developer On application installation I filtered OS logging by the swcd process and saw this logged: debug 08:40:01.125071-0800 swcd Skipping domain vz….qa….cl….ce….com?mode=developer because developer mode is disabled But developer mode IS enabled on the phone (Settings/Privacy & Security/Developer Mode is set to On). Therefore why is swcd saying developer mode is disabled? Is the developer mode mentioned in the documentation not actually the Developer Mode in the iPhone's setting but something else? That wouldn't appear to be the case because the documentation explicitly states "Specifies that only devices in developer mode can access the domain." Full Documentation: https://developer.apple.com/documentation/BundleResources/Entitlements/com.apple.developer.associated-domains If you use a private web server, which is unreachable from the public internet, while developing your app, enable the alternate mode feature to bypass the CDN and connect directly to your server. To do this, add a query string to your associated domains entitlement, as shown in the following example: :?mode= developer Specifies that only devices in developer mode can access the domain. So I've: turned developer mode on for the device have added ?mode=developer to the domain am building/running using a developer certificate. But why does swcd log that developer mode is disabled?
2
0
491
Jan ’25
When creating a nested framework, most but not all symbols found
I've got an app where I want to split its Model code into a framework (.xcframework and .framework for debugging) so that it can be used by more than one app. The code has dependencies on 3rd party code, which are installed via pods. During the conversion process I keep running into the same issue which manifests with all the 3rd party code - which is that the majority of its api can be used (something like 80-90%) but for the remainder there is a linker error at runtime showing undefined symbols. I have this problem with CocoaLumberjack,RealmSwift, PhoneNumberKit and more. Its very quick and easy to reproduce the issue with a minimal framework and minimal app, below I'll describe how a minimal setup using CocoaLumberjack reproduces the issue: From scratch, I use Xcode to create a framework project, run pod init, then modify the pod file to be: platform :ios, '16.0' workspace 'TheFramework' project 'TheFramework' target 'TheFramework' do use_frameworks! pod 'CocoaLumberjack/Swift', '3.8.5' end post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.0' config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES' end end end Then I add source code: import Foundation import CocoaLumberjack public class AClassInTheFramework { public class func aMethod() { let consoleLogger = DDOSLogger.sharedInstance DDLog.add(consoleLogger, with: .debug) DDLogDebug("Some logging") } } Within the Xcode project, Build Libraries for Distribution is set to Yes, I also add that line to the pod file in case CocoaLumberjack isn't set similarly. In the Framework's Xcode General section, Frameworks and Libraries contains Pods_TheFramework.framework set to Do Not Embed. In the Build Phases section, in the Link Binary with Libraries section, Pods_TheFramework.framework is set to required. Next I create an Xcode app template, run pod install, and edit the app pod file to be: platform :ios, '16.0' workspace 'AppUsingFramework' project 'AppUsingFramework' target 'AppUsingFramework' do use_frameworks! pod 'CocoaLumberjack/Swift', '3.8.5' end post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.0' end end end I build the framework, and drag and drop it into the app. I add the following code to the app's delegate: import TheFramework ... AClassInTheFramework.aMethod() The App's target has the following linkage settings: When I build and run the app, there is the following error: If I change the source code in the framework to this: public class AClassInTheFramework { public class func aMethod() { let consoleLogger = DDOSLogger.sharedInstance DDLog.add(consoleLogger, with: .debug) // DDLogDebug("Some logging") } } Then there is no error and the code runs successfully. This illustrates the problem I've encountered with all the nested frameworks - in this particular case calls to DDLog.add() don't result in an error but calls to DDlogDebug() do, and that has been mirrored with other nested frameworks (for example with Realm, opening a database, adding, finding,retrieving an item all works without a problem, however attempting to use Realm's Results<> API results in a similar symbol not found error). Additionally note that the identical CocoaLumberjack code can run fine when used directly from within the app, i.e., if I add the following code to the app: import CocoaLumberjack func useCocoaLumberjackDirectlyFromWithinApp() { let consoleLogger = DDOSLogger.sharedInstance DDLog.add(consoleLogger, with: .debug) DDLogDebug("Some logging") } useCocoaLumberjackDirectlyFromWithinApp() Then it runs, i.e. DDLogDebug() can be successfully called from within the app, its only when its called via the framework that the error occurs. Why might I be encountering these issues? I'd have thought either I'd be able to use 100% of the nested framework's public api, or 0% of it (is something is not configured correct), not ~80% which is what I am encountering. Any ideas? TIA
2
0
254
Mar ’25
Unexpected behavior with multiple apps installed which use shared groups
If I have two iOS apps, with bundle ids com.mycompany.A and com.mycompany.B, and they both have the shared group id of group.com.mycompany.B, then they can read/write data to same file (in shared defaults or, for example, a Realm database saved to the same shared group location). What I have noticed is that if both apps get installed and some data X written to shared defaults (but data which isn't accessed by both apps i.e. if only app A uses this data), then if app A is deleted and reinstalled then X is not deleted in this situation (unless both apps A and B are deleted). I guess that is to be expected as they both use the same group id and the OS won't clear that area out unless both apps are deleted. However I think I am seeing a situation where if app A has group.com.mycompany.A as its group and app B has group.com.mycompany.B as its group, then this is still the same situation - data written by app B for doesn't get deleted if only app B is deleted/reinstalled on the phone. It won't get deleted unless both app B and A are deleted from the phone. This is not what I was expecting. I need to perform some more checks (its more complex to verify as app A is developed by one company and app B by another), but if this were to be the case would this be unexpected behavior by the OS? Presumably it would be unexpected as the container should be identified by the full group id and not a partial portion of the group id right?
2
0
52
5d
Notification filtering entitlement not working on iOS 13
I'm running an app with the com.apple.developer.usernotifications.filtering entitlement and the filtering works fine with iOS 15. However I tried running it on an older phone / OS (iPhone 8 / iOS 13.1.2) and it does not work. Is this entitlement not supported with iOS 13.1.2? If so, what is the earliest iOS version that supports it? The handset logged this: The OS displayed: default 07:55:58.800825-0800 NotificationServiceExtension   Mutated notification request will not visibly alert the user, will deliver original content If the app is run on iOS 15, it says : default 07:20:27.251600-0800  SpringBoard        Mutated notification request will not visibly alert the user, will supress original content
1
0
1.2k
Dec ’21
Unwanted Communication Extension template code doesn't work
If a unwanted communication extension target is created,then the auto-generated template code doesn't work. This can very quickly be demonstrated by: In Xcode create a new iOS project In that project create an unwanted communication extension target (I called it cheese so its easy to see in the console) Add some logging lines to the UnwantedCommunicationReportingExtension code that was created. Install app to iPhone, and select it in the settings app Swipe on a call in the call history. The following lines can be seen in the iPhone console: Unknown class _TtC6cheese13MainInterface in Interface Builder file. View controller is not of class ILClassificationUIExtensionViewController None of the logging lines added to the code are displayed, also the Done button in the presented UI is disabled - but in the code that is generated by the target templete is:       self.extensionContext.isReadyForClassificationResponse = true Which is supposed to enable the Done button. In the storyboard that gets created the custom class is set to MainInterface: How are you supposed to get this stuff working if it doesn't work out of the box? MainInterface isn't being recognized as the view controller class, and in the drop down UnwantedCommunicationReportingExtension doesn't appear. class UnwantedCommunicationReportingExtension: ILClassificationUIExtensionViewController {          override func viewDidAppear(_ animated: Bool) {         super.viewDidAppear(animated) NSLog("viewDidAppear")                  // Notify the system when you have completed gathering information         // from the user and you are ready with a classification response         self.extensionContext.isReadyForClassificationResponse = true     }          // Customize UI based on the classification request before the view is loaded     override func prepare(for classificationRequest: ILClassificationRequest) { NSLog("prepare")         // Configure your views for the classification request     }       // Provide a classification response for the classification request     override func classificationResponse(for request:ILClassificationRequest) -> ILClassificationResponse {         return ILClassificationResponse(action: .none)     } }
1
0
1.6k
Mar ’22
Push to talk: how is the push token supposed to be used if its lifetime is ephemeral?
I don't understand how the push tokens are supposed to be used with push to talk given that their lifetime is ephemeral and they become invalid as soon as a channel is left. Suppose there is phone A and phone B, both with a PTT app installed on it. Then on phone A if the user launches the app and, for example, pushes a button to initiate a talk session with user B, then the app on phone A will join a channel and this will result in receivedEphemeralPushToken() getting called. Then if phone A sends that push token to the server, well then what next though? How is the user on phone B going to be informed that the user on phone A wants to talk to them. The server can't send a push to phone B using that token because that's the token for phone A. If the server has a token from phone B stored from previously, then the push isn't going to work because the documentation says the push token's lifetime is empemeral and will end as soon as the channel is left. So that channel for B's push token would have been left hours, or days or even months in the past. Summary: if user A wants to talk to user B, how does user B's app get notified user A want's to talk to them if the push tokens' lifetimes are all ephemeral?
1
1
1.3k
Aug ’22
Unable to upload app with iOS 16 background asset download extension to Testflight - invalid info.plist
I'm experimenting/testing the new background download extension. The documentation for it says that the applicationDidInstall() and applicationDidUpdate() methods are only called if the app is installed from the App Store or from Testflight (I tried installing via Apple Configurator 2 but they are not called then). Hence in order to check these out I have to first upload the app to Testflight, but there's an error about the info.plist - however the info.plist is created/populated using Xcode's target template for the extension, so if Xcode itself is incorrectly creating the info.plist how is one supposed to know what's wrong with it and how to fix it? This is the content of the info.plist that was generated: <key>EXAppExtensionAttributes</key> <dict> <key>EXExtensionPointIdentifier</key> <string>com.apple.background-asset-downloader-extension</string> <key>EXPrincipalClass</key> <string>$(PRODUCT_MODULE_NAME).BackgroundDownloadHandler</string> </dict> And the error uploading to Testflight P.S. There's no apparent relevant tag for this extension
1
0
948
Aug ’22
usernotifications.filtering entitlement prevents a contact with an image from being added/updated
My notification service extension has the com.apple.developer.usernotifications.filtering entitlement and it would appear that this is preventing a contact with an image from either being added or updated, any attempt to do so results in calls to CNContactStore.execute() throwing an CNInvalidRecords error. If the filtering entitlement is removed then there are no problems and the contact can be added/updated without problem. If the entitlement is present but the contact is added/updated without an image then it is also problem free. It is specifically adding a contact with an image that cannot be accomplished if the entitlement is present. I've encountered problems with this entitlement before - for example there are problems attempting to use a CXCallDirectoryManager from within a notification service extension with this extension. Quote from Apple on the call extension issue: "Because that entitlement can "hide" notifications, its sandbox profile is actually more restrictive than the standard NSE sandbox. That's what's preventing access to CXCallDirectoryManager, not the App ID properties.  -Kevin Elliott DTS Engineer, CoreOS/Hardware" I'd be appreciative if somebody from Apple could comment and confirm if the problems with updating contacts with an image with this entitlement is the same fundamental sandboxing issue? If so, I don't understand why a contact can be added with this entitlement, its only an issue if the contact has an image, does that imply a bug?
1
0
1k
Sep ’22
Xcode 14.1 beta: How do you run the backgroundassets-debug command?
If I run "man backgroundassets-debug" I get instructions/help/comments for using the backgroundassets-debug tool to simulate the background assets download framework (which has been added back to Xcode 14.1 beta 1 after being removed from Xcode 14 beta 3) But how do you actually run the backgroundassets-debug tool itself? "backgroundassets-debug -h" for example results in a command not found message. I tried searching for the tool within the Xcode 14.1 package but can't see it anywhere running "xcode-select -p" displays "/Applications/Xcode-beta.app/Contents/Developer" And "xcode-select -v" displays "xcode-select version 2395" Within Xcode preferences, command line tools is set to Xcode-beta 14.1
1
0
956
Sep ’22
Issues with https auth challenge and background asset download extension
I'm trying to get a background asset extension working with iOS 16.1/Xcode 14.1. I'm able to succesfully download a file when using BADownloadManger from within the app, but not if the extension tries to download the same file. I've discovered its not possible to use a url with http for the asset download as the OS performs a check and throws an exception saying only https is accepted. However when you use a https url there's an authentication challenge. I implemented the auth challenge method of BADownloadManagerProtocol within the app (it completes with AuthChallengeDisposition.performDefaultHandling) and the file is sucessfully able to be downloaded when the download is initiated from within the app. However, the same file cannot be downloaded when its downloaded from the extension. I implemented the BADownloaderExtension: didReceive challenge method within the extension (which returns the same thing, AuthChallengeDisposition.performDefaultHandling) however when the extension is attempted to be invokved (using the backgroundassets-debug command line tool) then the handset logs this: Failed to send -[BADownloaderExtensionProxy sendAuthenticationChallenge:download:completionHandler:]_block_invoke and the download fails. Why does the download succeed from the app but not from the extension? Why is the OS saying it can't send the auth challenge when I'm implemented the relevant method of BADownloaderExtension?
1
0
504
Oct ’22
What is an applicationName token?
I'm looking at this tutorial on app intents and shortcuts: https://arctouch.com/blog/implementing-app-shortcuts-intents And it says "Each phrase also has to contain your app name. To make it easier, you can provide the system with a list of synonyms for your app name and then use the applicationName token instead of your app name as a string literal" But it doesn't provide an example of using an applicationName token. I've tried searching for this but can't find anything. What is the applicationName token and what might an example of it being used be in a shortcut?
1
0
1.7k
Oct ’22
Push tokens: how to get a user/app to run after users transfers to a new phone?
If the user installs an application which uses push notifications onto iPhone A and then runs the app then the app will send the push token to the server (and from that point one the app should detect if the push token changes and send the new token to the server). However there's no way that the app can do this in the situation where the user backs up iPhone A to iCloud and then restores to iPhone B. If the user doesn't explicitly launch the application, then the application has no chance to detect that the push token will have changed, and so meanwhile the server is sending pushes using the token from phone A but the user now is using phone B. User's won't know they have to launch an app on phone B, and there's no way the app can launch itself, so the user's now have a non functioning app but they don't realise it. There must a lot of apps using push that face this situation, yet there's no solution? I was hoping iOS 16's background asset download might be a solution to this - if the extension gets called after restoring from iCloud it could detect the device change and thus push token change and post a notification to the user telling them they need to launch the app, but this extension appears to be functionally sandboxed and its not possible to post a notification from within it (unlike many other extensions).
1
0
546
Nov ’22