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

RevenueCat integration with Apple is returning only null values all the time
Hi All, I have setup RevenueCat integration with Apple for in-App purchase, signed all Business Agreements. x-checked all the keys and deleted and created subscription 100 times along with products in RevenueCat but only null is returned to my app by RevenueCat. I read and discussed with RevenueCat, as per them Apple returns null to them and they revert back null to users. Can someone please help me, I am struggling and out of wits. Don't know what to do. Any help, will be highly appreciated.
0
0
22
2h
Family Controls Usage Data
Hi all, For context, the Family Controls entitlement request (for the Personal Device Management category/individual use case) includes the question: Will your app share device or usage data beyond the individual for the individual use case, or Family Sharing for the parent/guardian use case, including through means such as screenshots, screen recordings, or server logging? I'm looking for clarification on how to interpret this. I originally answered Yes and was rejected, then later answered No and was accepted. Ideally, I would like my screen time management app to allow users to opt-in to social features. One simple example is opting into a leaderboard with your friends for who has the lowest screen time. If the user installed this app for themself and chooses to share this basic data with their friends, it sounds like an ethical and unproblematic feature but I suppose storing that data would fall under "server logging"? If anyone has any experience with this, I would appreciate a more explicit description of the requirement above. Is what I described allowed? Thanks for reading!
1
0
64
23h
Live Caller ID on iOS does not work - client requests not reaching backend
I'm reaching out to see if anyone else is experiencing issues with the Live Caller ID feature on iOS. We recently encountered a problem where the feature stopped working entirely. Here's a brief overview of the situation: We were monitoring test traffic on our backend and noticed everything came to a halt around 1:00 AM UTC on November 15th. After this time, any attempts to reach our backend through calls failed completely. I tested this across multiple devices running iOS 18.2 and iOS 18.0. I used both TestFlight builds and development builds via Xcode, which should communicate directly with our backend. I experienced the problem on our main application as well as a dedicated test app. To troubleshoot further, I even set up a local server on localhost and tried directing requests there, but the requests did not reach the local server when a call was received. Further debugging in Console.app revealed the following error: identity request returned error: Error Domain=com.apple.CipherML Code=400 "Error Domain=com.apple.CipherML Code=401 "Unable to request data by keywords batch: failed to fetch token issuer directory" However, when I manually tried to hit our server endpoint using curl, the request successfully reached the server: curl https://our_server/something hb_method=GET hb_uri=/something [Hummingbird] Request -- log on backend This suggests that while our backend is responsive, the requests from the iOS client side are simply not being initiated.
4
2
176
6d
Unable to Create Files Adjacent to User-Selected File Due to App Sandbox Permissions
I am developing a macOS app that requires the ability to create new files in the same directory as a user-selected file, but I am encountering permission issues due to the App Sandbox restrictions. While the user can select a file (e.g., a.jpg) using a standard open panel, I cannot create an adjacent file (e.g., a.jxl) in the same folder because the sandbox only grants access to the selected file, not to other files in the directory. I understand that full disk access might be an option, but it requires user intervention and isn't suitable for this case. Is there any way to extend access to other files in the directory (including those not selected by the user) while remaining within the App Sandbox environment?
2
0
44
4h
Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000020
I have built an iOS app using flutter. The app (debug and release build) works fine on real devices. But when trying to run integration tests on this app using appium on an emulator, the app keepas crashing randomly with these error logs: https://docs.google.com/document/d/1Z1f7hudmpHUATnFvoSZeAAoi8-NyVn6P9BFHNOZkzyA/edit?tab=t.0 Any help would be appreciated
0
0
23
7h
Memory for Apps under Vision OS
I have a Vision OS APP with memory requirement greater than 5120MB, is there any solution other than optimizing resources, dynamic loading and sub-scenarios? My Question: 1. I would like to know what is the maximum running memory of the APP under Vision OS? 2. Is it possible to modify the maximum running memory of an APP? 3. Does Vision OS provide an interface for jumping between apps?
0
0
33
11h
CFNetwork crash in CFURLRequestSetMainDocumentURL
I have received two strange crash reports from an iPad11,7 running iPadOS 15.1 and an iPad11,2 running iPadOS 15.2. On both occasions, the crashed thread calls CFURLRequestSetMainDocumentURL, which in turn calls _dispatch_source_set_runloop_timer_4CF in libdispatch, after which the application crashes with SIGSEGV and SEGV_MAPERR. The crashed thread's call stack is displayed below. Full crash logs are attached as well. What could this be? Exception Type: SIGSEGV Exception Codes: SEGV_MAPERR at 0x21d Crashed Thread: 20 Thread 20 Crashed: 0 libdispatch.dylib 0x00000001829e1784 _dispatch_source_set_runloop_timer_4CF + 36 1 CFNetwork 0x00000001834fc824 CFURLRequestSetMainDocumentURL + 2240 2 CFNetwork 0x00000001836b89a8 _CFNetworkErrorGetLocalizedDescription + 693652 3 CFNetwork 0x00000001834fdb1c CFURLRequestSetMainDocumentURL + 7096 4 CFNetwork 0x00000001834f3c34 CFURLRequestSetURL + 9668 5 libdispatch.dylib 0x00000001829ca914 _dispatch_call_block_and_release + 28 6 libdispatch.dylib 0x00000001829cc660 _dispatch_client_callout + 16 7 libdispatch.dylib 0x00000001829d3de4 _dispatch_lane_serial_drain + 668 8 libdispatch.dylib 0x00000001829d498c _dispatch_lane_invoke + 440 9 libdispatch.dylib 0x00000001829d5c74 _dispatch_workloop_invoke + 1792 10 libdispatch.dylib 0x00000001829df1a8 _dispatch_workloop_worker_thread + 652 11 libsystem_pthread.dylib 0x00000001f1eea0f4 _pthread_wqthread + 284 12 libsystem_pthread.dylib 0x00000001f1ee9e94 start_wqthread + 4 second_crashlog.txt report-2517628380750009999-e4d7ea06-6f22-4b7e-b129-045599e1dee5.txt
10
1
4.4k
Dec ’21
Handle InSendMessageIntent in the app
Hi, I'm implementing InSendMessageIntent handling in our app. I can handle InSendMessageIntent through extension, but handling also includes business logic like authorisation status and some heavy operation which I can't expose from the main target. I tried to handle it in-app, but func application(_ application: UIApplication, handlerFor intent: INIntent) -> Any? didn't trigger. At the first glance the configuration looks correct - the InSendMessageIntent is added under INIntentsSupported and UIApplicationSupportsMultipleScenes is set to YES in info.plist. After that reply with message button disappeared from the incoming Voip callKit screen. So I had a question - Is this intent possible to be handled in-app?
0
0
23
13h
Does @available work on Mac Catalyst AppKit Bundle Plugin?
A Mac Catalyst App Creates an AppKit Bundle Plugin in which @available does not work。 In AppKit Bundle Plugin, there is not watchOS and iOS version can not be higher than 28, but the log has been output. if (@available(watchOS 18.0, *)) { NSLog(@"bundle is available watchOS"); } if (@available(iOS 28.0, *)) { NSLog(@"bundle is available iOS"); } demo link: https://pan.baidu.com/s/1s_5qmsL6Bh-df3A1PfD0OA Extracted code: 5ndj
0
0
27
14h
iOS 15 and below log in problem
I have encountered a bug for Apple log in when user's iOS version is 15 or below. After completing the user email and password correctly, the it will trigger two factor authentication pop up with the code on screen. However, it will not display the screen to let user enter the two factor pass code and have a error saying the identity is wrong. I have tried to reboot the phone and log in Apple ID again. Both methods are not working. Looking for a solution here.
0
0
24
14h
Title: CoreFoundation CFRelease Crash on iOS 18
Hi everyone, I'm experiencing crashes that consistently occur on iOS 18 devices, which seem to share a common root cause. I'm hoping for some guidance. Here are the details of the crashes as received from Xcode Organizer: Crash Trace 1: 0 CoreFoundation 0x0000000192c50e54 CF_IS_OBJC + 76 (CFRuntime.c:461) 1 CoreFoundation 0x0000000192c4dd3c CFRelease + 60 (CFRuntime.c:1202) 2 CoreFoundation 0x0000000192d015e0 _signalEventSync + 252 (CFStream.c:636) 3 CoreFoundation 0x0000000192d53050 ___signalEventQueue_block_invoke + 28 (CFStream.c:646) 4 libdispatch.dylib 0x000000019a93c370 _dispatch_call_block_and_release + 32 (init.c:1549) 5 libdispatch.dylib 0x000000019a93e0d0 _dispatch_client_callout + 20 (object.m:576) 6 libdispatch.dylib 0x000000019a9456d8 _dispatch_lane_serial_drain + 744 (queue.c:3934) 7 libdispatch.dylib 0x000000019a9461e0 _dispatch_lane_invoke + 380 (queue.c:4025) 8 libdispatch.dylib 0x000000019a951258 _dispatch_root_queue_drain_deferred_wlh + 288 (queue.c:7193) 9 libdispatch.dylib 0x000000019a950aa4 _dispatch_workloop_worker_thread + 540 (queue.c:6787) 10 libsystem_pthread.dylib 0x000000021a00fc7c _pthread_wqthread + 288 (pthread.c:2696) 11 libsystem_pthread.dylib 0x000000021a00c488 start_wqthread + 8 (:-1) Crash Trace 2: 0 libobjc.A.dylib 0x0000000186f33c20 objc_msgSend + 32 1 CoreFoundation 0x0000000189cb14b8 _inputStreamCallbackFunc + 36 (CFObject.m:1952) 2 CoreFoundation 0x0000000189cb0aa8 _signalEventSync + 216 (CFStream.c:626) 3 CoreFoundation 0x0000000189d01e30 ___signalEventQueue_block_invoke + 28 (CFStream.c:646) 4 libdispatch.dylib 0x0000000191948370 _dispatch_call_block_and_release + 32 (init.c:1549) 5 libdispatch.dylib 0x000000019194a0d0 _dispatch_client_callout + 20 (object.m:576) 6 libdispatch.dylib 0x00000001919516d8 _dispatch_lane_serial_drain + 744 (queue.c:3934) 7 libdispatch.dylib 0x00000001919521e0 _dispatch_lane_invoke + 380 (queue.c:4025) 8 libdispatch.dylib 0x000000019195d258 _dispatch_root_queue_drain_deferred_wlh + 288 (queue.c:7193) 9 libdispatch.dylib 0x000000019195caa4 _dispatch_workloop_worker_thread + 540 (queue.c:6787) 10 libsystem_pthread.dylib 0x000000021214bc7c _pthread_wqthread + 288 (pthread.c:2696) 11 libsystem_pthread.dylib 0x0000000212148488 start_wqthread + 8 Crash Trace 3: 0 libobjc.A.dylib 0x00000001941d9ce8 objc_loadWeakRetained + 156 (NSObject.mm:525) 1 CoreFoundation 0x0000000196d0a0f4 _outputStreamCallbackFunc + 36 (CFObject.m:1960) 2 CoreFoundation 0x0000000196d09724 _signalEventSync + 216 (CFStream.c:626) 3 CoreFoundation 0x0000000196d07948 ___signalEventQueue_block_invoke + 28 (CFStream.c:646) 4 libdispatch.dylib 0x000000019e9de248 _dispatch_call_block_and_release + 32 (init.c:1549) 5 libdispatch.dylib 0x000000019e9dffa8 _dispatch_client_callout + 20 (object.m:576) 6 libdispatch.dylib 0x000000019e9e75cc _dispatch_lane_serial_drain + 768 (queue.c:3934) 7 libdispatch.dylib 0x000000019e9e8124 _dispatch_lane_invoke + 380 (queue.c:4025) 8 libdispatch.dylib 0x000000019e9f338c _dispatch_root_queue_drain_deferred_wlh + 288 (queue.c:7193) 9 libdispatch.dylib 0x000000019e9f2bd8 _dispatch_workloop_worker_thread + 540 (queue.c:6787) 10 libsystem_pthread.dylib 0x00000002220f3680 _pthread_wqthread + 288 (pthread.c:2696) 11 libsystem_pthread.dylib 0x00000002220f1474 start_wqthread + 8 Notable Points: All crashes occur only on iOS 18 and newer versions. The crashes are independent of the Xcode version used to build the app (tested with both Xcode 15.4 and 16). All crash traces occur in CoreFoundation and seem to have nothing related to our app codebase. I've attempted to profile the app using Instruments to identify any zombie objects, but the crashes do not manifest on my own devices. I've referred to discussions, including this forum thread, but have not yet found a solution. Questions: Has anyone else encountered similar issues on iOS 18? Are there specific aspects of iOS 18 that might contribute to these CoreFoundation and libobjc-related crashes? Would appreciate any suggestions for further diagnostics or potential workarounds. Thank you for your help!
2
1
65
1d
AppleID Login API is not activated after 2 months
This is Saeid from Drion.ai Ag company in Germany. We are s marketing startup and we are developing a marketing platform we need to give opportunity to our users to sign in using Apple ID. I have sent all of the company documents, my ID card, and all documents that we have in our company just to activate the AppID login API and it is nothing after more than 2 months. I had a call from Apple support and she told me to send some documents I did it, but nothing yet. Is this Apple company's suport for developers?!
0
0
335
May ’24
MISSING_AUTH REST response?
I haven't gotten any hits searching for this, so I decided to open a new thread. The Tech Note that was mentioned in an earlier 2024 thread doesn't mention this error. I've been trying different ways to get a token, and finally found this article that seems to be in the correct format. https://dev.to/hasone/generate-jwt-token-for-apple-store-connect-api-using-python-3j5h The Apple App Store Server Swift Library was supposed to have a createJWT() method, but it's gone now. curl -v -H 'Authorization: Bearer [token]' "https://weatherkit.apple.com/api/v1/availability/37.323/122.032?country=US" Host weatherkit.apple.com:443 was resolved. IPv6: (none) IPv4: 23.66.3.87, 23.66.3.70, 23.66.3.74, 23.66.3.72, 23.66.3.81, 23.66.3.75, 23.66.3.91, 23.66.3.71, 23.66.3.73 Trying 23.66.3.87:443... Connected to weatherkit.apple.com (23.66.3.87) port 443 ALPN: curl offers h2,http/1.1 (304) (OUT), TLS handshake, Client hello (1): CAfile: /etc/ssl/cert.pem CApath: none (304) (IN), TLS handshake, Server hello (2): (304) (IN), TLS handshake, Unknown (8): (304) (IN), TLS handshake, Certificate (11): (304) (IN), TLS handshake, CERT verify (15): (304) (IN), TLS handshake, Finished (20): (304) (OUT), TLS handshake, Finished (20): SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384 / [blank] / UNDEF ALPN: server accepted http/1.1 Server certificate: subject: C=US; ST=California; O=Apple Inc.; CN=weather-data.apple.com start date: Oct 9 21:14:44 2024 GMT expire date: Jan 7 20:21:03 2025 GMT subjectAltName: host "weatherkit.apple.com" matched cert's "weatherkit.apple.com" issuer: C=US; O=Apple Inc.; CN=Apple Public Server ECC CA 1 - G1 SSL certificate verify ok. using HTTP/1.x GET /api/v1/availability/37.323/122.032?country=US HTTP/1.1 Host: weatherkit.apple.com User-Agent: curl/8.7.1 Accept: / Authorization: Bearer [token] Request completely sent off < HTTP/1.1 401 Unauthorized < Server: Apple < Content-Type: application/json < Content-Length: 26 < X-Frame-Options: SAMEORIGIN < Strict-Transport-Security: max-age=31536000; includeSubdomains < X-XSS-Protection: 1; mode=block < Access-Control-Allow-Origin: * < X-Content-Type-Options: nosniff < Content-Security-Policy: default-src 'self'; < X-REQUEST-ID: 320cab08-acba-0127-fe19-4893dacf059c < X-Apple-Origin: 3c6511d9-6be2-32cb-8412-efd1b1efa576 < Content-Disposition: inline;filename=f.txt < Date: Tue, 15 Oct 2024 10:40:01 GMT < X-Cache: TCP_MISS from a23-220-165-87.deploy.akamaitechnologies.com (AkamaiGHost/11.6.5-30d892fcde524eb1bee7eeb45111707d) (-) < Connection: keep-alive < Connection #0 to host weatherkit.apple.com left intact {"reason": "MISSING_AUTH"}
0
0
164
Oct ’24
Premature DeviceActivityEvent Triggering
Our app monitors device usage and applies a shield when the set time limit is reached. Multiple DeviceActivitySchedules can be present, each with different time limits. To display notifications at 50% of the total limit for each DeviceActivitySchedule, we set a warning time at half of the total time. However, we occasionally receive premature event callbacks. For example, consider a schedule from 13:00 to 13:30 with a single event threshold at 10 minutes and a warning time of 5 minutes. The 'eventDidReachThreshold' callback is delivered prematurely, along with the 'eventWillReachThresholdWarning' callback, at 13:10. Additionally, in some cases, when one DeviceActivitySchedule ends and the next begins immediately, DeviceActivityEvents registered for the new DeviceActivitySchedule are delivered prematurely along with the schedule start callback. For example, consider there are two DeviceActivitySchedules from 12:00 to 13:00 and from 13:00 to 14:00, each with a limit of 10 minutes and a warning time of 5 minutes. When the first schedule ends and the next begins at 13:00, the 'eventDidReachThreshold' callbacks for the events registered in the second schedule are delivered prematurely, along with the 'intervalDidStart' callback.
1
0
74
11h
Can I Detect Which App the User Opens Using the Screen Time API?
I'm working with the Screen Time API in iOS and have successfully implemented the following: Granted Screen Time Permission: The app asks for and obtains Screen Time permissions without any issues. Blocked Specific Apps: Using FamilyActivitySelection, I can block access to certain apps. Monitoring Device Activity: With DeviceActivityCenter().startMonitoring(), I’m able to successfully start monitoring. DeviceActivityCenter().startMonitoring(.myActivity, during: schedule) Now, I’m wondering if there’s a way to detect exactly which app the user opens, so I can fire an API from my own app based on that event. Is this kind of real-time app usage detection possible with the Screen Time API? If so, how might it be implemented?
1
0
59
2d
Background update home widget iOS
The application was initially written in Swift, and we released an update where the app was rewritten in Flutter. Currently, we are adding a widget natively written in SwiftUI to the Home screen. The widget updates are managed by BGTaskScheduler. In BGTaskScheduler, an API request is made to fetch the latest data. The data is then processed to calculate an average value, which is subsequently sent to UserDefaults. The widget displays data fetched from UserDefaults. The minimum update interval is set to 30 minutes. When testing the widget updates through a build in Xcode, the widget updates as expected at the specified interval. However, when this build was provided to users via TestFlight, the widget does not update for them. Could this issue be related to TestFlight’s resource limitations? Is there any guarantee that releasing this version will ensure the widget updates correctly for users?
2
0
81
1d
How to add a reoccurring Hebrew Event to a calendar.
Currently Apple has their own calendar called Birthdays which takes the birthdays from contacts and makes it as a regular calendar event along with the birthday number, they even do this for Hebrew Birthdays. I have tried (unsuccessfully thus far) to take the same concept and create a calendar for reoccurring events on a specific date in the Hebrew Calendar. An example of this would be Yahrtzeits, which is observed on the Hebrew date each year after a person dies. I want to add it to the system calendars like how Apple does it this way it can be used with any app not just my own. Currently there isn't a way to specify the calendar (like Calendar(identifier: .hebrew) or even make a custom EKRecurrenceRule, also from some of the debugging of the Birthdays calendar, it seems that the date saved is the Gregorian date and that theres some internal calculations happening. Is there a way to add reoccurring Hebrew Events or do I need to reinvent the wheel?
0
0
38
1d
File transfer issue from iPhone to Watch after iOS 17.5 & WatchOS 10.5 update
After updating to iOS 17.5 & WatchOS 10.5, the didFinish response from WCSessionDelegate does not come when transferring files from iPhone to Watch. It worked normally until 17.4 & 10.4. There is no problem with checking file completion even if a didFinish response is not received, but I think Apple needs to check this issue and update. File transfer is done using the transferFile function of WCSession. The file being transferred is a single file and its size does not exceed 30MB. When you try to transfer Pi, the message below appears in the Xcode log section. -[WCFileStorage persistOutgoingFileTransfer:] error serializing file transfer <WCSessionFileTransfer: 0x300155d60, session file: <WCSessionFile: 0x3001575c0, identifier: 0C8857EC-7D74-4E78-BA28-6C5526DE8949, file: /private/var/mobile/Containers/Data/Application/DD797847-DED1-42C0-989F-34CD05825007/tmp/C042D096-F12B-4B50-8792-868475DBBF47.zip, hasMetadata: YES>, transferring: YES> due to Error Domain=NSCocoaErrorDomain Code=4866 "Caught exception during archival: This object may only be encoded by an NSXPCCoder. ( 0 CoreFoundation 0x000000019b064f2c 00E76A98-210C-3CB5-930B-F236807FF24C + 540460 1 libobjc.A.dylib 0x0000000192ef6018 objc_exception_throw + 60 2 Foundation 0x0000000199fe7778 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 1419128 3 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428 4 WatchConnectivity 0x000000021d055f60 1AB4DDD6-9238-3965-B744-819F2916C8CC + 126816 5 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428 6 WatchConnectivity 0x000000021d0567f0 1AB4DDD6-9238-3965-B744-819F2916C8CC + 129008 7 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428 8 Foundation 0x0000000199f30628 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 669224 9 WatchConnectivity 0x000000021d0583ac 1AB4DDD6-9238-3965-B744-819F2916C8CC + 136108 10 WatchConnectivity 0x000000021d04390c 1AB4DDD6-9238-3965-B744-819F2916C8CC + 51468 11 WatchConnectivity 0x000000021d046640 1AB4DDD6-9238-3965-B744-819F2916C8CC + 63040 12 Foundation 0x0000000199ea9be0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 117728 13 Foundation 0x0000000199ea9aa0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 117408 14 Foundation 0x0000000199ea98a0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 116896 15 Foundation 0x0000000199ea7b40 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 109376 16 Foundation 0x0000000199f2c558 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 652632 17 Foundation 0x0000000199f2c1a4 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 651684 18 libdispatch.dylib 0x0000000105ed7764 _dispatch_block_async_invoke2 + 148 19 libdispatch.dylib 0x0000000105ec67bc _dispatch_client_callout + 20 20 libdispatch.dylib 0x0000000105ec98e0 _dispatch_continuation_pop + 676 21 libdispatch.dylib 0x0000000105ec8bb8 _dispatch_async_redirect_invoke + 680 22 libdispatch.dylib 0x0000000105edaae4 _dispatch_root_queue_drain + 404 23 libdispatch.dylib 0x0000000105edb4d8 _dispatch_worker_thread2 + 188 24 libsystem_pthread.dylib 0x00000001f7ebb8f8 _pthread_wqthread + 228 25 libsystem_pthread.dylib 0x00000001f7eb80cc start_wqthread + 8 )" UserInfo={NSDebugDescription=Caught exception during archival: This object may only be encoded by an NSXPCCoder. ( 0 CoreFoundation 0x000000019b064f2c 00E76A98-210C-3CB5-930B-F236807FF24C + 540460 1 libobjc.A.dylib 0x0000000192ef6018 objc_exception_throw + 60 2 Foundation 0x0000000199fe7778 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 1419128 3 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428 4 WatchConnectivity 0x000000021d055f60 1AB4DDD6-9238-3965-B744-819F2916C8CC + 126816 5 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428 6 WatchConnectivity 0x000000021d0567f0 1AB4DDD6-9238-3965-B744-819F2916C8CC + 129008 7 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428 8 Foundation 0x0000000199f30628 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 669224 9 WatchConnectivity 0x000000021d0583ac 1AB4DDD6-9238-3965-B744-819F2916C8CC + 136108 10 WatchConnectivity 0x000000021d04390c 1AB4DDD6-9238-3965-B744-819F2916C8CC + 51468 11 WatchConnectivity 0x000000021d046640 1AB4DDD6-9238-3965-B744-819F2916C8CC + 63040 12 Foundation 0x0000000199ea9be0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 117728 13 Foundation 0x0000000199ea9aa0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 117408 14 Foundation 0x0000000199ea98a0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 116896 15 Foundation 0x0000000199ea7b40 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 109376 16 Foundation 0x0000000199f2c558 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 652632 17 Foundation 0x0000000199f2c1a4 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 651684 18 libdispatch.dylib 0x0000000105ed7764 _dispatch_block_async_invoke2 + 148 19 libdispatch.dylib 0x0000000105ec67bc _dispatch_client_callout + 20 20 libdispatch.dylib 0x0000000105ec98e0 _dispatch_continuation_pop + 676 21 libdispatch.dylib 0x0000000105ec8bb8 _dispatch_async_redirect_invoke + 680 22 libdispatch.dylib 0x0000000105edaae4 _dispatch_root_queue_drain + 404 23 libdispatch.dylib 0x0000000105edb4d8 _dispatch_worker_thread2 + 188 24 libsystem_pthread.dylib 0x00000001f7ebb8f8 _pthread_wqthread + 228 25 libsystem_pthread.dylib 0x00000001f7eb80cc start_wqthread + 8 )}
28
13
4.0k
May ’24
Contacts: remove member from group not working on macOS
Hi, In my app, I have an option to remove a contact from a contact group (using the Contacts framework), and it's been working fine till recently users of the macOS version reported that it's not working. I have been using the CNSaveRequest removeMember(contact, from: group) API. The same API works fine on iOS. I'm not sure when it started but it seems to be affecting macOS14.6 as well as 15.1. I was able to reproduce it in a small test project as well, and have the same experience (the API works on iOS but not on macOS), so it definitely seems like a problem with the framework. Can someone confirm this, and/or suggest a workaround? Here's the code I run to test it out ...a simple SwiftUI view that has 4 buttons: Create contact and group Add contact to group Remove contact from group (optional) cleanup by deleting contact and group It's the 3rd step that seems to fail on macOS, but works fine on iOS. Here's the code to test it out: struct ContentView: View { let contactsModel = ContactsStoreModel() var body: some View { VStack (alignment: .center, spacing: 15){ Button ("1. Add Contact And Group") { print("add contact button pressed") contactsModel.addTestContact() if let _ = contactsModel.createdContact { print("created contact success") } } Button ("2. Add Contact To Group") { print("add to group button pressed") contactsModel.addContactToGroup() } Button ("3. Remove Contact From Group") { print("remove from group button pressed") contactsModel.removeContactFromGroup() } Button ("4. Delete Contact and Group") { print("remove from group button pressed") contactsModel.deleteContactAndGroup() } } .padding() } } #Preview { ContentView() } @available(iOS 13.0, *) @objc final class ContactsStoreModel: NSObject, ObservableObject { let contactStore = CNContactStore() var createdContact : CNContact? var createdGroup : CNGroup? public func addTestContact() { let storeContainer = contactStore.defaultContainerIdentifier() let contact = CNMutableContact() contact.givenName = "Testing" contact.familyName = "User" contact.phoneNumbers = [CNLabeledValue(label: "Cell", value: CNPhoneNumber(stringValue: "1234567890"))] let group = CNMutableGroup() group.name = "Testing Group" print("create contact id = \(contact.identifier)") print("create group id = \(group.identifier)") do { let saveRequest = CNSaveRequest() saveRequest.transactionAuthor = "TestApp" saveRequest.add(contact, toContainerWithIdentifier: storeContainer) saveRequest.add(group, toContainerWithIdentifier: storeContainer) try contactStore.execute(saveRequest) createdContact = contact createdGroup = group } catch { print("error in store execute = \(error)") } } public func addContactToGroup() { if let contact = createdContact, let group = createdGroup { do { let saveRequest = CNSaveRequest() saveRequest.transactionAuthor = "TestApp" saveRequest.addMember(contact, to: group) try contactStore.execute(saveRequest) } catch { print("error in store execute = \(error)") } } } public func removeContactFromGroup() { if let contact = createdContact, let group = createdGroup { do { let saveRequest = CNSaveRequest() saveRequest.transactionAuthor = "TestApp" saveRequest.removeMember(contact, from: group) try contactStore.execute(saveRequest) } catch { print("error in store execute = \(error)") } } } public func addGroupAndContact() { let storeContainer = contactStore.defaultContainerIdentifier() let group = CNMutableGroup() group.name = "Test Group" print("create group id = \(group.identifier)") if let contact = createdContact { do { let saveRequest = CNSaveRequest() saveRequest.transactionAuthor = "TestApp" saveRequest.add(group, toContainerWithIdentifier: storeContainer) saveRequest.addMember(contact, to: group) try contactStore.execute(saveRequest) createdGroup = group } catch { print("error in store execute = \(error)") } } } public func deleteContactAndGroup() { if let contact = createdContact, let group = createdGroup { do { let mutableGroup = group.mutableCopy() as! CNMutableGroup let mutableContact = contact.mutableCopy() as! CNMutableContact let saveRequest = CNSaveRequest() saveRequest.transactionAuthor = "TestApp" saveRequest.delete(mutableContact) saveRequest.delete(mutableGroup) try contactStore.execute(saveRequest) } catch { print("error in deleting store execute = \(error)") } } } }
0
0
60
2d