Delve into the world of built-in app and system services available to developers. Discuss leveraging these services to enhance your app's functionality and user experience.

Post

Replies

Boosts

Views

Activity

My iOS app that I created since 2011, crashes on M4 machine (M1 is fine!)
A user gave me the crash log on his M4 machine when he first launches the app. I have M1 and my app works fine, which begs the question, why M4 has the crash! This is my app the I developed since 2011 until now. Any hints will be appreciated or anyone has similar issues like to share? ------------------------------------- Translated Report (Full Report Below) ------------------------------------- Incident Identifier: DA1CEECB-28D4-40A9-8F0C-7125812084F4 CrashReporter Key: FB8A5DBB-7140-D370-AC72-EC158266383C Hardware Model: Mac16,3 Process: Stocks Live [5506] Path: /private/var/folders/*/Stocks Live.app/Stocks Live Identifier: com.cinnamonmobile.StocksLive Version: 34.2 (34.2.0) AppStoreTools: 16B39 AppVariant: 1:MacFamily20,1:18 Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd [1] Coalition: com.cinnamonmobile.StocksLive [2018] Date/Time: 2024-11-27 12:41:48.0456 -0500 Launch Time: 2024-11-27 12:41:47.5710 -0500 OS Version: macOS 15.1.1 (24B2091) Release Type: User Report Version: 104 Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Subtype: KERN_MEMORY_ERROR at 0x0000000120034000 Exception Codes: 0x000000000000000a, 0x0000000120034000 VM Region Info: 0x120034000 is in 0x120034000-0x120038000; bytes after start: 0 bytes before end: 16383 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL CoreAnimation 120030000-120034000 [ 16K] rw-/rwx SM=PRV ---> mapped file 120034000-120038000 [ 16K] r--/rw- SM=COW Object_id=14630bfe CoreAnimation 120038000-12003c000 [ 16K] r--/r-- SM=PRV Termination Reason: SIGNAL 10 Bus error: 10 Terminating Process: exc handler [5506] Triggered by Thread: 0 Kernel Triage: decmpfs - (arg = 0x80000001) compressor is not registered APFS - (arg = 0x200040) Pagein of compressed inode failed VM - (arg = 0x190000002d) Filesystem pagein returned an error in vnode_pagein VM - (arg = 0x0) Page has error bit set Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 CoreFoundation 0x18803f48c __CFStringCreateImmutableFunnel3 + 716 1 FincancialCoreFrameWork 0x10358d3c4 -[MOStringDocument loadFromContents:ofType:error:] + 156 2 UIKitCore 0x1ba34a67c __32-[UIDocument readFromURL:error:]_block_invoke + 104 3 libdispatch.dylib 0x187e20658 _dispatch_client_callout + 20 4 libdispatch.dylib 0x187e2fdb0 _dispatch_async_and_wait_invoke + 92 5 libdispatch.dylib 0x187e20658 _dispatch_client_callout + 20 6 libdispatch.dylib 0x187e2ef68 _dispatch_main_queue_drain + 980 7 libdispatch.dylib 0x187e2eb84 _dispatch_main_queue_callback_4CF + 44 8 CoreFoundation 0x1880f8e60 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 9 CoreFoundation 0x1880b8a4c __CFRunLoopRun + 1996 10 CoreFoundation 0x1880b7bc4 CFRunLoopRunSpecific + 588 11 HIToolbox 0x193529f64 RunCurrentEventLoopInMode + 292 12 HIToolbox 0x19352fd54 ReceiveNextEventCommon + 636 13 HIToolbox 0x19352feb8 _BlockUntilNextEventMatchingListInModeWithFilter + 76 14 AppKit 0x18bbe398c _DPSNextEvent + 660 15 AppKit 0x18c523ddc -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688 16 AppKit 0x18bbd6a64 -[NSApplication run] + 480 17 AppKit 0x18bbad2e8 NSApplicationMain + 888 18 AppKit 0x18bdfb7f4 _NSApplicationMainWithInfoDictionary + 24 19 UIKitMacHelper 0x1a28f8b38 UINSApplicationMain + 972 20 UIKitCore 0x1b99de3a8 UIApplicationMain + 148 21 Stocks Live 0x102bcc058 0x102bc4000 + 32856 22 dyld 0x187c50274 start + 2840 Thread 1:: Dispatch queue: UIDocument File Access 0 libsystem_kernel.dylib 0x187f93b8c __ulock_wait + 8 1 libdispatch.dylib 0x187e21048 _dlock_wait + 56 2 libdispatch.dylib 0x187e20dfc _dispatch_thread_event_wait_slow + 56 3 libdispatch.dylib 0x187e2ffc4 __DISPATCH_WAIT_FOR_QUEUE__ + 368 4 libdispatch.dylib 0x187e2fb70 _dispatch_sync_f_slow + 148 5 UIKitCore 0x1ba351384 -[UIDocument(UIDocumentInternal) _performBlock:synchronouslyOnQueue:] + 76 6 UIKitCore 0x1ba347ff0 __40-[UIDocument openWithCompletionHandler:]_block_invoke + 588 7 libdispatch.dylib 0x187e1e8f8 _dispatch_call_block_and_release + 32 8 libdispatch.dylib 0x187e20658 _dispatch_client_callout + 20 9 libdispatch.dylib 0x187e27c60 _dispatch_lane_serial_drain + 744 10 libdispatch.dylib 0x187e28768 _dispatch_lane_invoke + 380 11 libdispatch.dylib 0x187e337e8 _dispatch_root_queue_drain_deferred_wlh + 288 12 libdispatch.dylib 0x187e33034 _dispatch_workloop_worker_thread + 540 13 libsystem_pthread.dylib 0x187fcf3d8 _pthread_wqthread + 288 14 libsystem_pthread.dylib 0x187fce0f0 start_wqthread + 8 Thread 2: 0 libsystem_pthread.dylib 0x187fce0e8 start_wqthread + 0 Thread 3: 0 libsystem_pthread.dylib 0x187fce0e8 start_wqthread + 0
3
0
145
6d
Problem with reading NFC tag in background in not working with NFC ISO 14443-3A
Hi folks, I have trouble with reading NFC tag in background while my application is running. I still receives a message in my iPhone 13, NFC tag of web Open "donator.cz" in application Safari. But I would like to open the app Donator which is here: https://apps.apple.com/dk/app/don%C3%A1tor/id6473955033 My NFC chip scanned by "NFC Tools" is ISO 14443-3A (NXP-NTAG213) In the tag is mentioned https://donator.cz/<8digits-number>**text In my Info.plist of application is: <key>LSApplicationQueriesSchemes</key> <array> <string>https://donator.cz</string> </array> <key>com.apple.developer.nfc.readersession.felica.systemcodes</key> <array> <string>12FC</string> </array> <key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key> <array> <string>D2760000850101</string> </array> Apple CDN looks like: https://app-site-association.cdn-apple.com/a/v1/donator.cz I have read in Apple documentation https://developer.apple.com/documentation/corenfc/adding-support-for-background-tag-reading that application should be in progress A Core NFC reader session is in progress. How to do it in AppDelegate or SceneDelegate. One note is that everything works properly in case of reading NFC based on button click is pressed. My NFCHandler looks like: // // NFCReader.swift // Donator // // Created by Petr Hracek on 22.11.2024. // import Foundation import UIKit import CoreNFC class NFCHandler: NSObject, NFCNDEFReaderSessionDelegate { var readerSession: NFCNDEFReaderSession? func startBackgroundScanning() { guard NFCNDEFReaderSession.readingAvailable else { return } readerSession = NFCNDEFReaderSession(delegate: self, queue: DispatchQueue.main, invalidateAfterFirstRead: true) readerSession?.alertMessage = "Prilozte NFC tag" readerSession?.begin() } func readTag(session: NFCNDEFReaderSession , tags: [NFCNDEFTag] ) { if tags.count > 1 { // Restart polling in 500ms let retryInterval = DispatchTimeInterval.milliseconds(500) session.alertMessage = "More than 1 tag is detected, please remove all tags and try again." DispatchQueue.global().asyncAfter(deadline: .now() + retryInterval, execute: { session.restartPolling() }) return } // Connect to the found tag and perform NDEF message reading let tag = tags.first! session.connect(to: tag, completionHandler: { (error: Error?) in if nil != error { session.alertMessage = "Unable to connect to tag." session.invalidate() return } tag.queryNDEFStatus(completionHandler: { (ndefStatus: NFCNDEFStatus, capacity: Int, error: Error?) in if .notSupported == ndefStatus { session.alertMessage = "Tag is not NDEF compliant" session.invalidate() return } else if nil != error { session.alertMessage = "Unable to query NDEF status of tag" session.invalidate() return } tag.readNDEF(completionHandler: { (message: NFCNDEFMessage?, error: Error?) in var statusMessage: String if nil != error || nil == message { statusMessage = "Fail to read NDEF from tag" } else { statusMessage = "Found 1 NDEF message" DispatchQueue.main.async { // Process detected NFCNDEFMessage objects. debugPrint(message!) //self.tableView.reloadData() } } session.alertMessage = statusMessage session.invalidate() }) }) }) } /// - Tag: sessionBecomeActive /// This method will called when NFC session become active /// Tells the delegate that the session detected NFC tags with NDEF messages. func readerSessionDidBecomeActive(_ session: NFCNDEFReaderSession) { debugPrint("NFC session become active======") } func readerSessionDidInvalidate(_ session: NFCNDEFReaderSession) { debugPrint("NFC session invalidate======") } func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) { print(error) } func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) { for message in messages { for record in message.records { print("Type name format: \(record.typeNameFormat)") print("Payload: \(record.payload)") print("Type: \(record.type)") print("Identifier: \(record.identifier)") } } } /// - Tag: processingNDEFTag /// if This method is not implement then only func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) will call /// Tells the delegate that the session detected NFC tags with NDEF messages and enables read-write capability for the session. func readerSession(_ session: NFCNDEFReaderSession, didDetect tags: [NFCNDEFTag]) { self.readTag(session: session, tags: tags) } }
1
0
87
1w
Bundle.main.preferredLocalizations vs. Locale.preferredLanguages vs. "AppleLanguages"
On iOS Bundle.main.preferredLocalizations returns the list of languages the application bundle supports in user-preferred order with the first element being the language the application is running in. Additionally Locale.preferredLanguages returns the list of languages in the order they are presented in Preferences.app &gt; General &gt; Language &amp; Region &gt; Preferred Languages with the first element being the user's "primary language" (i.e. the language the system is running in). However this only seems to be true unless the user has chosen a per-app language which is different from the primary language in which case Locale.preferredLanguages.first is equal to Bundle.main.preferredLocalizations.first - regardless of the latter's position in the Preferred Languages list. Furthermore this seems to change depending on the value of the "AppleLanguages" key in the User Defaults' global domain (see c.f. https://stackoverflow.com/a/42648166). Is this behaviour documented anywhere? Addendum: I know that according to https://forums.developer.apple.com/forums/thread/718512?answerId=733680022#733680022 AppleLanguages is an implementation detail, not something that’s considered API. Locale.preferredLanguages is API, though.
0
0
104
1w
siri crash
Question: A very small number of users experience this crash: NSInternalInconsistencyException:Use of the class INVocabulary requires the entitlement com.apple.developer.siri. Make sure you have enabled the Siri capability in your Xcode project. But our project definitely has siri configured to be available. During app startup, calling the following code causes a crash: INVocabulary *vocabulary = [INVocabulary sharedVocabulary]; Now that we can't figure it out, is it a bug in the system?
0
0
81
1w
Contact Provider Extension via Managed App (MDM) = managed contacts?
When using Mobile Device Management (MDM), it is possible to restrict access to contacts on managed devices. Please see https://support.apple.com/en-us/101932 According to this article, contacts are considered "managed" if they come from either a managed app or a managed account. Does this principle also apply when an MDM-managed app provides contacts via the Contact Provider Extension (CPE)? Specifically, would such "managed" contacts remain inaccessible to unmanaged apps? Our goal is to ensure that unmanaged apps cannot access these contacts. Thanks!
0
0
103
1w
IOS 18.1.1 CarPlay
After upgrading to IOS 18.1.1 CarPlay became terrible. During music playback via USB cable the subwoofer stopped working. Bass is not heard. Sound became very poor. It is impossible to exit CarPlay by pressing the button on the multimedia. if I Disconnect the cable from the phone - the multimedia (radio) works fine again and the subwoofer works normally. CarPlay blocks pressing the keys on the multimedia system. Also it is not possible to update the multimedia, because multimedia menu is inaccessible. When I connect the phone via Bluetooth the timer on the multimedia screen immediately starts, as if I am talking on the phone to somebody. Sound quality via Bluetooth is even worse than via USB. Listening to music (the main function) has become impossible. Please fix this problem. Thank you very much!
1
0
345
1w
Live Caller ID Extension -
I am currently working on implementing the Live Caller ID Extension for my iOS app, and I understand that a backend server is required for this functionality. While I’ve gone through Apple’s documentation, the details on the backend setup are limited and not very clear for my backend team to implement it effectively. Could someone provide a more detailed explanation or sample implementation of the backend server required for this extension? Specifically, we are looking for: A clear understanding of the APIs and endpoints the backend needs to expose. Any authentication mechanisms required for communication with the extension. Data format (e.g., JSON structure) for requests and responses. Example code or additional resources, if available. Any help or guidance in understanding the exact backend requirements would be greatly appreciated.
1
0
131
1w
Crash occurs in both @MainActor classes and functions on iOS 14
Crash occurs in @MainActor class or function in iOS 14 Apps built and distributed targeting Xcode 16 version swift6 crash on iOS 14 devices. We create a static library and put it in our app's library. Crash occurs in all classes or functions of the static library (@MainActor in front). It does not occur from iOS / iPadOS 15. If you change the minimum supported version of the static library to iOS 11, a crash occurs, and if you change it to iOS 14, a crash does not occur. Is there a way to keep the minimum version of the static library at iOS 11 and prevent crashes?
1
0
114
1w
ios18.2 public beta - Wallpaper/AOD issue
Hi all. Since upgrading to a new iPhone 16 pro, running 18.2 public beta, I'm having issue with my wallpaper/Lock Screen. If AOD is turned OFF, my lock screen is almost too dim to read, and the chosen Lock Screen wallpaper has a blurred effect on it. if AOD is ON, the screen is still too dim to read, and the wallpaper is just a faint shade of the colour of the image chosen.
0
0
102
1w
How NSMutableString works under the hood ?
I want to understand how it manages memory allocation if i need more memory later than the memory i specified during initialisation . Does it allocates new chunk of memory and dellocate older memory or does it already allocated more memory than i asked for in first place? Just want to understand how exactly this calculation is done ? And i do initialisation of NSMutableString in swift , will these same principle of expension applied there ?
1
0
148
1w
Video Camera Issues
Has anyone experienced frozen images when having camera on video recording mode? For example i live in Los Angeles and sometimes I like to record the sunrise or sunset or while I’m crossing a bridge but my video camera kinda freezes and doesn’t record. I’ve already checked my memory and I have more than enough to not have issues maybe it’s a setting issue? if anyone has a solution or suggestions please let me know thank you.
0
0
47
1w
EKEventStore on Apple Watch not showing all calendars
I have released a watchOS-specific application that retrieves data from the iPhone calendar app and displays it on the Apple Watch. It uses the calendars function in EKEventStore to retrieve the list of calendars, but it seems that it sometimes fails to retrieve iCloud calendars. Trouble is, this problem only occurs in a very few users‘ environments, the majority of other users’ environments are able to retrieve them without any problems, and I cannot reproduce it at all in my environment. Local calendars and Google calendars seem to be retrieved without any problems. Minimal example code: import SwiftUI import EventKit struct ContentView: View { let eventStore = EKEventStore() @State var success: Bool = false @State var calendarNames: [String] = [String]() func request() async { success = (try? await eventStore.requestFullAccessToEvents()) ?? false } func list() { calendarNames = eventStore.calendars(for: .event).map { $0.title } } var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Access: \(success.description)") ScrollView { ForEach(calendarNames, id: \.self) { name in Text(name) } } } .onAppear { Task { await request() list() } } .padding() } } I asked the user experiencing the problem to try restarting the iPhone and Apple Watch, reinstalling the app and re-pairing them, but there was no change. I would appreciate any information you can provide. Best regards.
0
0
103
1w
Evidently I'm not generating API tokens right.
I'm trying (in Swift) to use CryptoKit to generate the required JWT for the Apple Music Web API, as documented (sort of) here. But I'm getting 401s no matter what I try. I found some examples of generating JWTs online, but something isn't working here. I've set up my identifiers and gotten an API secret through my account in the dev portal. It's associated with an identifier requesting Music API access (I requested all three available Music-related capabilities). For the secret, I'm using the long key string from the .p8 file I generated and downloaded from the dev portal. Here's what I've tried: struct APIToken { struct Header: Encodable { let alg = "HS256" let kid: String } struct Payload: Encodable { let iss: String let iat: String let exp: String } static func tokenize(keyID: String, issuerID: String, secret: String) -> String { let privateKey = SymmetricKey(data: Data(secret.utf8)) let headerJSONData = try! JSONEncoder().encode(Header(kid: keyID)) let headerBase64String = headerJSONData.base64EncodedString() let currUnixTime = Int(Date().timeIntervalSince1970) let expUnixTime = currUnixTime + 5 * 2628288 // five months of seconds let payloadJSONData = try! JSONEncoder().encode(Payload(iss: issuerID, iat: "\(currUnixTime)", exp: "\(expUnixTime)")) let payloadBase64String = payloadJSONData.base64EncodedString() let toSign = Data((headerBase64String + "." + payloadBase64String).utf8) let signature = HMAC<SHA256>.authenticationCode(for: toSign, using: privateKey) let signatureBase64String = Data(signature).base64EncodedString() let token = [headerBase64String, payloadBase64String, signatureBase64String].joined(separator: ".") print(token) return token } } I also tried making sure the base64 strings are URL-safe with this extension: extension Data { func URLSafeBase64EncodedString() -> String { return base64EncodedString() .replacingOccurrences(of: "+", with: "-") .replacingOccurrences(of: "/", with: "_") .replacingOccurrences(of: "=", with: "") } } but that made no difference. All the documentation says is A decoded developer token has the following format. { "alg": "ES256", "kid": "ABC123DEFG" } { "iss": "DEF123GHIJ", "iat": 1437179036, "exp": 1493298100 } After you create the token, sign it with your MusicKit private key using the ES256 algorithm. Am I not doing that? Any insight appreciated.
0
0
100
1w
ios18 Beta Skipping Podcast Episodes
Been enjoying the ios18 Beta. Wanted to provide something I noticed since upgrading to the Beta. When I stop an episode midway through and add the episode back to my queue, my phone now skips the episode as already played. So i either miss the rest of the episode, if I don’t catch it, or have to go back and reset it, to hear the partially finished episode. Hopefully this can be addressed in future updates! :)
2
0
122
1w
Worst update to photos app ever
iOS 18 is the worst update to the Apple photos app ever. There was nothing wrong with iOS 17 photos app. You guys took a perfectly usa and funtio app and thought of myriad different ways to make it less intuitive and usable. Why even mess with the favorites pictures album. You have to scroll down/up scroll through your favorites when for your regular pictures you have to swipe up/down to scroll. Completely nonsensical. ios 18 is a downgrade to the photos app in e way
1
0
69
1w