Post

Replies

Boosts

Views

Activity

Is Xcode 16 a battery drainer?
I've got a 2023 M2 MacBook Pro and used to get great battery life out of it (> 6 hours when using it for development purposes). Now however, all of a sudden, that has dropped off a cliff, and the only thing that has changed is Xcode 16 has appeared. As I'm compiling a project I can literally see the % amount of the battery charge remaining tick down in front of my eyes as I watch. I just compiled a project twice and during that time the battery dropped from from %89 to %79 and Xcode is listed as a culprit using significant battery drain. Anybody else noticed anything similar? Anything that can be done to to decrease Xcode's battery drain?
2
0
443
Oct ’24
Why does a text filter extension receive the ISO Country Code, but not the text server?
The documentation for a text filter extension states that receiverISOCountryCode is a field the extension receives https://developer.apple.com/documentation/sms_and_call_reporting/ilmessagefilterqueryrequest/3979257-receiverisocountrycode "The ISO Country Code of the receiving phone number" However, if the extension defers to its text server, then the payload sent to the server doesn't contain the iso country code: POST /server-endpoint HTTP/1.1 Accept: */* Content-Type: application/json; charset=utf-8 Content-Length: 148 { "_version": 1, "query": { "sender": "14085550001", "message": { "text": "This is a message" } }, "app": { "version": "1.1" } } from: https://developer.apple.com/documentation/sms_and_call_reporting/ilmessagefilterextensioncontext/2880240-deferqueryrequesttonetwork Why does the payload sent to the text server not contain the country code?
2
0
387
Dec ’24
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
484
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
494
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
257
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
66
1w
Notification content extensions not working in 10.2
I wrote a notification content extension which with 10.1 was working perfectly and reliably - it was getting called 100% of the time, as it should, and eveything was great and working as it should.But now with 10.2 I just cannot get the bugger to work at all - the extension just isn't being called by the OS (actually it was called once out of about 30 attempts and on that one occasion the UNNotificationExtensionDefaultContentHidden YES flag was ignored, which it didn't use to be with 10.1)Anybody else having problem with content extensions with 10.2, but if not is there some trick or tweak or change you applied to get them to work?
4
0
3.8k
Aug ’22
Notification displayed via Notification Service Extension doesn't display correctly if the iPhone is passcode protected and locked
I've got a notification service extension which is working as expected unless the user a) turns the passcode for the iPhone on and b) turns on Auto-lock and the iPhone is locked when a push arrives If auto-lock is turned on and the phone is locked but passcode is not turned on, then the notification is displayed as expected. The iPhone displays a notification with the top line being the name of the app and the second line saying "Notification", which is neither the content within the push payload, not what is being set as the content within the extension. There's no difference in behaviour of the extension when passcode is enabled. Adding logging to the extension I can confirm the content is being replaced and posted as expected: NSLog("Going to post notification title: \(notificationContent.title) subtitle: \(notificationContent.subtitle) body: \(notificationContent.body)") contentHandler(notificationContent) The notificationContent is as expected and is identical when passcode is on off. Why is the iPhone displaying the notification incorrectly if passcode is turned on and the phone locked?
3
0
1k
Jan ’22
How is one supposed to create a Background Assets extension? There's no extension type for this existing in Xcode beta 5
I want to use features described in the background assets WWDC22 session, however with Xcode 14 Beta 5 there is no application extension of this type. There was an application extension type with beta 4, but there are two problems with this firstly Testflight doesn't recognize it so its impossible to upload and therefore use (because some of the features are documented as only working when the app is installed from Testflight/App Store). secondly, if one creates an extension using Xcode beta 4, then it complies with beta 4, but it won't compile with beta 5. Therefore it is currently impossible to even begin to start working with the background assets extension framework.
3
0
1.1k
Sep ’22
How to implement background asset downloading feature?
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?
3
0
1.6k
Dec ’22
Xcode 14.1 is unable to provision an asset download extension
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?
3
1
1.7k
Jan ’23
"ITMS-90338: Non-public API usage - The app references non-public selectors" issue still present when uploading to TestFlight, except now its preventing builds from appearing
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.
3
0
896
Feb ’23
Is there any way of adjusting logging level dynamically at run time?
I've gone through several tutorials, and the documentation, it seems there's no way to adjust the logging level dynamically, or even at build time for that matter. i.e. there is apparently nothing that exists such as: static let logger = Logger(subsystem: subsystem(), category: category()) logger.setMinimalLevel(.Warning) logger.trace("I won't get displayed because minimal level is debug") Am I mistaken and there is something like this?
3
0
743
Sep ’23