Post

Replies

Boosts

Views

Activity

Is there a way of accessing/viewing files in an iOS app's shared group location from a Mac?
My goal is to try and get a unified logging system set up where logging from an iOS app and its extensions (primarily a notification service extension) get written into one central repository. So I was planning on setting up CocoaLumberjack in the app and the extension to use the same file path/name, adding the group capability to the app and the extensions and specifying the shared group directory as the file path. By default, for an app, CocoaLumberjack writes its files to: var/mobile/Containers/Data/Application/05464D4A-20F6-4E1F-9DBC-3109C053A1E8/Library/Caches/Logs/ On a Mac using an application such as iExplorer the above file and be located and viewed and copied etc. For an extension, it writes them to: /var/mobile/Containers/Data/PluginKitPlugin/5542F5EA-EB3A-4728-B33E-4E57C1B7B3B4/Library/Caches/Logs/ Now if I configure Cocoalumberjack to instead write the logger file to the shared group directory, then that will be at: /private/var/mobile/Containers/Shared/AppGroup/6CD5AF2C-54C9-46EF-B831-997B1DD6664F/ However its not possible using iExplorer to access this location. Using a Mac connected to the iPhone, is there an app or tool etc., that will enable me to locate the log file if it's created in the above AppGroup location?
1
0
756
Sep ’23
Push token change on app upgrade
Our app has some Crashlytics & Localytics reporting to collect metrics for diagnostic and info gathering. One thing I'm noticing recently is that if a user has version m of the app installed and updates to version m+1, then for some users, the app has detected and reported that the push token obtained with version m+1 is different from that of version m (for the same handset). That's fine - if the app has detected the change to the token it can send the new one to the server so the server can update. But my question is - if the user didn't explicitly launch the app and thus present the app with the chance to send the new token to the server, then what will happen to the pushes sent by the server using the old token? Presumably they won't get delivered if the token has changed, but if the user has no need to launch the app then they're never going to receive any pushes from the server until they do launch the app. However there's not necessarily any reason why a user should repeatedly launch an app once it's been set up (depending upon what it does and how it delivers info to the user and how the user interacts with it, there's no reason why a user should have to launch the app after initial installation and launch). If so then this seems like a gap in the design of push notifications? If they can change on the same handset, or another scenario is the user backs up their device to iCloud and then restores to a different handset, then in that case the push tokens will have definitely changed, yet any apps using push don't get the chance to send the new token to the server until the user launches the app, meanwhile all pushes from the server will be dropped.
1
0
760
Sep ’23
Xcode 15.0 Beta 6 is unusable due to hanging installation and attaching phases
The previous betas have all been ok, but beta 6 is for me totally and utterly unusable because it keeps hanging forever during the installation and attaching phases when trying to run an app (attached physically via cable, not bluetooth). The first time or two of making a code change, then running, its ok, but then its guaranteed to hang eventually, it gets stuck on the "Installing app to iPhone" phase. If I restart the phone and try again it might get past that, but then it just gets stuck on "Waiting to attach to app on iPhone" phase. I know its beta software and not expected to be perfect, but its unusable and previous beta versions are no longer available to rollback to. Has anybody encountered this before and knows of any tricks to get it to stop hanging and load/run the app? (Restarting Xcode, restarting the phone, re-building, does not fix it for me)
1
0
392
Aug ’23
CXProvider.reportNewIncomingVoIPPushPayload() behavior changed with iOS 16.6
I've been successfully using CXProvider.reportNewIncomingVoIPPushPayload() as follows: a (non VoIP) push is sent to the handset this is intercepted by a notification service extension the extension calls CXProvider.reportNewIncomingVoIPPushPayload() (the extension has the required com.apple.developer.usernotifications.filtering entitlement) this results in the app delegate's implementation of PKPushRegistryDelegate:didReceiveIncomingPushWithPayload getting called (the app is launched if terminated) This all works as expected, in particular when the app is terminated it still works. However its suddenly stopped working since my phone got updated to iOS 16.6 (I can't remember exactly what was on it previously, 16.5 or 16.4). Now with iOS 16.6 the behavior is that PKPushRegistryDelegate:didReceiveIncomingPushWithPayload() only gets called if the app is not terminated. If the app is terminated then calling CXProvider.reportNewIncomingVoIPPushPayload() results in the app getting launched and didFinishLaunchingWithOptions() getting called BUT didReceiveIncomingPushWithPayload() is not called when launching from a terminated state. As a consequence of didReceiveIncomingPushWithPayload() not getting called, the app isn't calling reportNewIncomingCallWithUUID() and so after a few runs the OS stops launching the app entirely saying: "Application will not be launched because it failed to report an incoming call too many times". When didFinishLaunchingWithOptions() is called the launchOptions are nil, i.e. there is no way to distinguish the app from being launched as a consequence of reportNewIncomingVoIPPushPayload()(*) being called and therefore it is not possible to call reportNewIncomingCallWithUUID(). So this feature is totally broken apparently from previous behavior. Any comment? TIA (*)Well actually, the extension could write a flag to a shared group and the app read that on launch, but what a hack, and should be unnecessary.
1
0
619
Aug ’23
OSLog: anyway to get unified/combined logging from app and app extensions?
I've got a complex app extension and I'd like to be able to combine the logging from the app and the extension into a single file (for extraction/uploading etc.) I experimented adding the following code to both the app and the extension i.e. using the same subsystem for both app and extension logging. let subsystem = "mySubsystem" let logger = Logger(subsystem: subsystem, category: "main") logger.info("Log from within extension") // the version in the app says Log from within app do { let logStore = try OSLogStore(scope: .currentProcessIdentifier) let oneHourAgo = logStore.position(date: Date().addingTimeInterval(-3600)) let allEntries = try logStore.getEntries(at: oneHourAgo) let filtered = allEntries .compactMap { $0 as? OSLogEntryLog } .filter { $0.subsystem == subsystem } } The filtered content only contains logging from either the app or the extension. I suppose the issue might be the use of .currentProcessIdentifier as the scope, however that's the only scope that is defined. Is what is being attempted here possible? Is there any way to write to and extract a unified log for an app and app extension? If not, how about adding it, surely this would be something useful for people to be able to do
1
0
589
Aug ’23
When does a notification service extension process get terminated?
If there is the following code for a notification service extension var countOfInvocations = 0 public class NotificationService: UNNotificationServiceExtension { public override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { NSLog("Push count: \(countOfInvocations)") countOfInvocations = countOfInvocations + 1 Then if pushes are sent to the handset it can be observed in the console log that the value of countOfInvocations keeps increasing, meaning the NotificationService class is getting instantiated and destroyed within the same process. However at what point does that process get torn down by the OS? It seems to be kept alive for about 10 minutes or so. Is there a way the extension can detect its the same or a new process?
1
0
496
Jul ’23
CallKit call extension invoked twice by the OS in iOS 17 beta
If you create a CallKit extension with Xcode 15 beta, then add some logging to the template code that gets created and run it on an iOS 17.3 beta phone the logging clearly shows that the OS is running the extension twice when the user turns on the extension in Settings. Run it on any device with < iOS 17 and its only invoked once, as it should be. However, not only does the OS run it twice, but based on the logging the two invocations are in parallel, not serial, suggesting two CallDirectoryHandler instances are being created and run simultaneously.
1
1
654
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
311
Jul ’23
How do you file a feature request?
If you go to https://feedbackassistant.apple.com and create a new feedback (for iOS and iPad) item, then these are the types of feedback choices: Incorrect/Unexpected Behavior Application Crash Application Slow/Unresponsive Battery Life Suggestion A suggestion sounds more like something an iPhone user want so suggest as a feature, not how a developer might request an API feature. Is that really what, as a developer, you are supposed to use to make a development feature request?
4
0
2.7k
Jul ’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
515
Jul ’23
Xcode 15 only produces a cycle inside build error
My app builds fine with Xcode 14, 13 and 12, but when attempting to build it with Xcode 15 there's an "Cycle inside MyApp; building could produce unreliable results." error. The output below isn't giving me any clues that I can see about what the cause of the cycle is nor how to fix it, any ideas? Cycle inside MyApp; building could produce unreliable results. Cycle details: → Target 'MyApp': ExtractAppIntentsMetadata ○ Target 'MyApp': CodeSign /Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Products/Debug-iphoneos/MyApp.app/Frameworks/3rdPartyFramework.framework ○ Target 'MyApp' has copy command from '/Users/me/Desktop/Checkouts/MyApp/theApp/MyApp/ios/3rdPartyFramework.framework' to '/Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Products/Debug-iphoneos/MyApp.app/Frameworks/3rdPartyFramework.framework' ○ Target 'MyApp' has copy command from '/Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Products/Debug-iphoneos/CallExtension.appex' to '/Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Products/Debug-iphoneos/MyApp.app/PlugIns/CallExtension.appex' ○ That command depends on command in Target 'MyApp': script phase “Add Git/CI Build Info” ○ Target 'MyApp' has process command with output '/Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Products/Debug-iphoneos/MyApp.app/Info.plist' ○ Target 'MyApp' has copy command from '/Users/me/Desktop/Checkouts/MyApp/theApp/MyApp/ios/3rdPartyFramework.framework' to '/Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Products/Debug-iphoneos/MyApp.app/Frameworks/3rdPartyFramework.framework' Raw dependency cycle trace: target: -> node: <all> -> command: <all> -> node: /Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Intermediates.noindex/ProjectA.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/ExtractedAppShortcutsMetadata.stringsdata -> command: P0:target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6-:Debug:ExtractAppIntentsMetadata -> node: <target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6--package-copy-files-phase> -> command: P0:::Gate target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6--package-copy-files-phase -> node: <target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase11-copy-files> -> command: P0:::Gate target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase11-copy-files -> node: <CodeSign /Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Products/Debug-iphoneos/MyApp.app/Frameworks/3rdPartyFramework.framework> -> command: P0:target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6-:Debug:CodeSign /Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Products/Debug-iphoneos/MyApp.app/Frameworks/3rdPartyFramework.framework -> node: <Copy /Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Products/Debug-iphoneos/MyApp.app/Frameworks/3rdPartyFramework.framework> -> CYCLE POINT -> command: P0:target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6-:Debug:Copy /Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Products/Debug-iphoneos/MyApp.app/Frameworks/3rdPartyFramework.framework /Users/me/Desktop/Checkouts/MyApp/theApp/MyApp/ios/3rdPartyFramework.framework -> node: <target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase10--cp--copy-pods-resources> -> command: P0:::Gate target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase10--cp--copy-pods-resources -> node: /Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Intermediates.noindex/ProjectA.build/Debug-iphoneos/MyApp.build/InputFileList-F72A917A68CD9152103DBA60-Pods-MyApp-resources-Debug-input-files-037b34732b45cb31a2dcb00ffdfe9f5c-resolved.xcfilelist -> command: P2:target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6-:Debug:WriteAuxiliaryFile /Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Intermediates.noindex/ProjectA.build/Debug-iphoneos/MyApp.build/InputFileList-F72A917A68CD9152103DBA60-Pods-MyApp-resources-Debug-input-files-037b34732b45cb31a2dcb00ffdfe9f5c-resolved.xcfilelist -> node: <target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase9--cp--embed-pods-frameworks> -> command: P0:::Gate target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase9--cp--embed-pods-frameworks -> node: /Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Intermediates.noindex/ProjectA.build/Debug-iphoneos/MyApp.build/InputFileList-7E0D6830477C665FCC1083CC-Pods-MyApp-frameworks-Debug-input-files-36820974ee8465975a73448c9644b936-resolved.xcfilelist -> command: P2:target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6-:Debug:WriteAuxiliaryFile /Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Intermediates.noindex/ProjectA.build/Debug-iphoneos/MyApp.build/InputFileList-7E0D6830477C665FCC1083CC-Pods-MyApp-frameworks-Debug-input-files-36820974ee8465975a73448c9644b936-resolved.xcfilelist -> node: <target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase8-upload-crashlytics> -> command: P0:::Gate target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase8-upload-crashlytics -> node: <target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase7-upload-debug-symbols-to-sentry> -> command: P0:::Gate target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase7-upload-debug-symbols-to-sentry -> node: <target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase6-crashlytics> -> command: P0:::Gate target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase6-crashlytics -> node: <target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase5-copy-files> -> command: P0:::Gate target-MyApp-2a7e5ca2b3fd2ca0faca1487721e3ae07ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase5-copy-files -> node: <Copy /Users/me/Library/Developer/Xcode/DerivedData/ProjectA-frqscjhianktlvbxgbzostesljpn/Build/Products/Debug-iphoneos/MyApp.app/PlugIns/CallExtension.appex> -> <snip> too large to post all
13
4
5.4k
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
810
Jun ’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
522
Jun ’23