Post

Replies

Boosts

Views

Activity

GKMatch: GameKitServices crashes in GCKSessionReceiveDOOB on the second real-time match — the finished session is never reclaimed
We ship a two-player real-time GameKit game. On iOS 27 the app crashes inside GameKitServices on the second real-time match of any app session — nine times out of nine yesterday. Filed as FB24789094 (and FB24788999 for a separate reinvitation problem). Posting the measurements here because the unified log makes the mechanism visible, and because everything I tried at the app level failed — maybe somebody has the missing piece. THE CRASH Main thread, no application frame anywhere on the stack: CFRetain + 52 GCKSessionReceiveDOOB + 1632 -[GKSessionInternal receiveDOOB:fromPeer:inSession:context:] + 320 -[GKSessionInternal(_private) tellDelegate_didReceiveBand_RetryICE:] + 212 __NSThreadPerformPerform + 264 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ EXC_BAD_ACCESS (SIGBUS), EXC_ARM_DA_ALIGN at 0x9 (0xa in one report). In every report the faulting address is exactly x0 + 8, and x0 is 1 or 2 — CFRetain is handed a small integer, not a pointer. A use-after-free would fault on a large plausible-looking address; 1 and 2 are not addresses at all. Address Sanitizer agrees: no heap error is reported before the fault, only __asan::ReportDeadlySignal directly above the same three GameKitServices frames. It reads like type confusion in the RetryICE band path. Not the SDK: a build made with Xcode 26.6 against iphoneos26.5 crashes identically — same stack, same registers. The peer's OS does not matter either (iPadOS 17.7.11, iOS 26.6.1 and iOS 27.0 all seen on the other side, and in one case an older build of our own app). Only the crashing device is always on iOS 27.0 (24A435), an iPhone 15 Pro. RECIPE Two devices, two Game Center accounts. Form a two-player real-time GKMatch — GKMatchmaker.findMatch(for:) or an invitation, both reproduce. Wait for the peer to connect, call finishMatchmaking(for:). Play for ten seconds or so, so data really flows. End it: match.disconnect(), release the GKMatch. In the SAME process, form a SECOND real-time match. Play. The crash lands roughly ten to thirty seconds after the second match starts exchanging data. A first match in a freshly launched process has never crashed for us. Out of eleven app sessions that reached a second match, two were force quit by hand during other tests and the remaining nine all crashed here. THE SESSION IS NEVER RECLAIMED GameKit runs one "com.apple.gamekitservices.gcksession.recvproc" / "sendproc" thread pair per live real-time session, in the app's own process. You can count them from inside the app, which turns out to be the only way to see what is going on: var threads: thread_act_array_t? var count: mach_msg_type_number_t = 0 task_threads(mach_task_self_, &threads, &count) // then pthread_from_mach_thread_np(threads[i]) + pthread_getname_np, and compare the name Measured across one app session: after Game Center authentication, before any match ......... 0 first match live ........................................... 1 right after match.disconnect() returns ..................... 1 <- not reclaimed before the second match is adopted ......................... 2 right after the second match's disconnect() ................ 2 Every crash report shows two of those pairs alive, although the app holds exactly one GKMatch at a time and releases the finished one the instant disconnect() returns. The same leak is visible on iOS 26.6.1 (an iPhone 11 Pro leaks identically) — it just does not crash there. WHAT THE LEFTOVER SESSION DOES Each match gets its own CDXClient. The first match's is never torn down, and keeps poking its hole on a 30-second keep-alive, on the same local port (:16402) the second match then binds: 15:28:05.117 <CDXClient: 0x155872e40> requesting-hole-punch <- match 1 15:28:35.289 <CDXClient: 0x155872e40> requesting-hole-punch <- match 1, +30s, match already over 15:28:50.197 <CDXClient: 0x12d4bda40> requesting-hole-punch <- match 2 15:29:05.287 <CDXClient: 0x155872e40> requesting-hole-punch <- match 1 again, 4s before the crash GCKSessionCreate:6425 globalscopelaunch appears once per process; the second match only does 6509 globalscoperequest and reuses the global scope. During the second match's ICE setup a packet arrives belonging to no live session: -[CDXClient handleFDEvent]:1066 packet-from-unknown-session -[CDXClient handleFDEvent]:1067 Incoming packet from unknown session. SID = ... immediately followed by [ERROR] ICEStopConnectivityCheck:2763 ICEStopConnectivityCheck() found no ICE check with call id (...) [ERROR] gckSessionCheckPendingConnections:1545 iICEChecksLeft=0, iUnconnectedNodeCount=0, iDDsExpected=1 Those lines appear exactly three times in a 28-minute window, all three in the two processes that went on to crash, never during a first match. About fourteen seconds later the RetryICE band is delivered and CFRetain is called on the garbage. WHAT DID NOT WORK Releasing the GKMatch immediately after disconnect(). The session threads stay. Waiting. Gaps of 17, 19, 22, 25, 30 and 45 seconds between the two matches all crashed. Tearing the match down cleanly. I suspected that calling disconnect() while match.players was still non-empty was the trigger — five out of five such teardowns were followed by a crash. So I made the quitting side announce its departure, wait for match(_:player:didChange:) to report the peer gone, and only then disconnect. It works (disconnect now runs with players == 0) and it changes nothing: the count still reads 1 afterwards, and the next match still crashes. Worth saying explicitly, because the correlation was strong enough to look causal. Skipping finishMatchmaking(for:). No effect. The only thing that reliably avoids it is allowing a single real-time match per app launch, which is a poor thing to ship. QUESTIONS Is there a supported way to make GameKit release a finished GKMatch's session inside the process? A GKMatch that never connected (peer wait timed out, disconnect() on an empty match) appears to leave the same residue, so it is not about how the match ended. And has anyone else seen GCKSessionReceiveDOOB / tellDelegate_didReceiveBand_RetryICE? I could not find a single mention of these symbols anywhere.
2
2
878
1d
iOS 18.4 - HomeKit actions from AppIntent fail when triggered from Widget
Hi all, Since updating to iOS 18.4, I'm experiencing a regression with AppIntents triggered from Widgets. In my app, I use AppIntents inside a WidgetKit extension to control HomeKit devices. This setup was working perfectly up to iOS 18.3. However, starting with iOS 18.4, when the AppIntent is triggered from the widget and the main app is not running, the action fails with this error: Error Domain=HMErrorDomain Code=80 "Missing entitlement for API." UserInfo={ NSLocalizedFailureReason=Handler does not support background access, NSLocalizedDescription=Missing entitlement for API. } Interestingly, the exact same AppIntent works fine if the app is still alive in the background — it seems like the failure only occurs when the intent is handled by the widget process. This looks like a behavior change or new restriction introduced in iOS 18.4. Has anyone experienced the same? Is there a new entitlement needed, or a recommended workaround? Thanks in advance!
3
2
1.1k
Jun ’25
Xcode 15: Disable the content margins for widget preview? (contentMarginsDisabled)
Hi guys, I am migrating my widgets to iOS 17 and because I already manage my layout margins, I just want to disable to new built-in widget content margins. I did it by using ".contentMarginsDisabled()" on the WidgetConfiguration and it works fine at run time. WIDGET CODE struct MyWidget: Widget { let kind: String = "MyWidget" var body: some WidgetConfiguration { return IntentConfiguration(kind: kind, intent: MyWidgetIntent.self, provider: WidgetProvider<MyWidgetIntent>()) { entry in WidgetView<MyWidgetIntent>(entry: entry) } .configurationDisplayName("My Widget") .supportedFamilies([WidgetFamily.systemMedium]) .contentMarginsDisabled() // <-- HERE } } RESULT Nevertheless, when previewing the WidgetView in a WidgetPreviewContext I didn't find anyway to disable the content margins (because manipulating directly the view and not a WidgetConfiguration). PREVIEW CODE struct MyWidget_Previews: PreviewProvider { static var previews: some View { WidgetView<MyWidgetIntent>(entry: WidgetEntry<MyWidgetIntent>()) // .padding(-16) Need to add this negative padding to disable margin .previewContext( WidgetPreviewContext(family: .systemMedium)) } } Do you know how to disable the content margins for widget preview?
2
0
3.9k
Mar ’24
Xcode 15.3 & iOS 17.4 app install issue: Framework is missing its bundle executable.
After updating Xcode to version 15.3, I can't install my app either on simulator or real device on iOS 17.4. Here is the error message I got when installing (Build succeed): Please try again later. `Framework is missing its bundle executable. Please check your build settings to make sure that a bundle executable is produced at the path 'MyApp.app/Frameworks/GoogleMobileAds.framework/GoogleMobileAds'` I don't have any issue when deploying on iOS 17.0.1, 17.2 or 17.3 on both sim and device. Does anyone face the same issue? Detail of the error: Impossible d’installer « My App » Domain: IXUserPresentableErrorDomain Code: 1 Recovery Suggestion: My App.app/Frameworks/GoogleMobileAds.framework is missing its bundle executable. Please check your build settings to make sure that a bundle executable is produced at the path "My App.app/Frameworks/GoogleMobileAds.framework/GoogleMobileAds". User Info: { DVTErrorCreationDateKey = "2024-03-18 20:12:00 +0000"; IDERunOperationFailingWorker = IDEInstallCoreDeviceWorker; } -- Impossible d’installer « My App » Domain: IXUserPresentableErrorDomain Code: 1 Recovery Suggestion: My App.app/Frameworks/GoogleMobileAds.framework is missing its bundle executable. Please check your build settings to make sure that a bundle executable is produced at the path "My App.app/Frameworks/GoogleMobileAds.framework/GoogleMobileAds". User Info: { IDERunOperationFailingWorker = IDEInstallCoreDeviceWorker; } -- Failed to install the app on the device. Domain: com.apple.dt.CoreDeviceError Code: 3002 User Info: { NSURL = "file:///Users/clement/Library/Developer/Xcode/DerivedData/MyApp-dwgovybwoaicqghaqtvbngdkplip/Build/Products/Debug-iphoneos/My%20App.app/"; } -- Impossible d’installer « My App » Domain: IXUserPresentableErrorDomain Code: 1 Failure Reason: Réessayez ultérieurement. Recovery Suggestion: My App.app/Frameworks/GoogleMobileAds.framework is missing its bundle executable. Please check your build settings to make sure that a bundle executable is produced at the path "My App.app/Frameworks/GoogleMobileAds.framework/GoogleMobileAds". -- My App.app/Frameworks/GoogleMobileAds.framework is missing its bundle executable. Please check your build settings to make sure that a bundle executable is produced at the path "My App.app/Frameworks/GoogleMobileAds.framework/GoogleMobileAds". Domain: MIInstallerErrorDomain Code: 71 User Info: { FunctionName = "-[MIExecutableBundle executableExistsWithError:]"; SourceFileLine = 1580; } -- lstat of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.cYcAbK/extracted/My App.app/Frameworks/GoogleMobileAds.framework/GoogleMobileAds failed: No such file or directory Domain: NSPOSIXErrorDomain Code: 2 Failure Reason: No such file or directory User Info: { FunctionName = "-[MIFileManager itemExistsAtURL:error:]"; SourceFileLine = 1340; } -- Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : { "device_isCoreDevice" = 1; "device_isWireless" = 1; "device_model" = "iPhone12,3"; "device_osBuild" = "17.4 (21E219)"; "device_platform" = "com.apple.platform.iphoneos"; "dvt_coredevice_version" = "355.24"; "dvt_mobiledevice_version" = "1643.100.58"; "launchSession_schemeCommand" = Run; "launchSession_state" = 1; "launchSession_targetArch" = arm64; "operation_duration_ms" = 10200; "operation_errorCode" = 1; "operation_errorDomain" = IXUserPresentableErrorDomain; "operation_errorWorker" = IDEInstallCoreDeviceWorker; "operation_name" = IDERunOperationWorkerGroup; "param_debugger_attachToExtensions" = 0; "param_debugger_attachToXPC" = 1; "param_debugger_type" = 3; "param_destination_isProxy" = 0; "param_destination_platform" = "com.apple.platform.iphoneos"; "param_diag_MainThreadChecker_stopOnIssue" = 0; "param_diag_MallocStackLogging_enableDuringAttach" = 0; "param_diag_MallocStackLogging_enableForXPC" = 1; "param_diag_allowLocationSimulation" = 1; "param_diag_checker_tpc_enable" = 1; "param_diag_gpu_frameCapture_enable" = 0; "param_diag_gpu_shaderValidation_enable" = 0; "param_diag_gpu_validation_enable" = 0; "param_diag_memoryGraphOnResourceException" = 0; "param_diag_queueDebugging_enable" = 1; "param_diag_runtimeProfile_generate" = 0; "param_diag_sanitizer_asan_enable" = 0; "param_diag_sanitizer_tsan_enable" = 0; "param_diag_sanitizer_tsan_stopOnIssue" = 0; "param_diag_sanitizer_ubsan_stopOnIssue" = 0; "param_diag_showNonLocalizedStrings" = 0; "param_diag_viewDebugging_enabled" = 1; "param_diag_viewDebugging_insertDylibOnLaunch" = 1; "param_install_style" = 0; "param_launcher_UID" = 2; "param_launcher_allowDeviceSensorReplayData" = 0; "param_launcher_kind" = 0; "param_launcher_style" = 99; "param_launcher_substyle" = 8192; "param_runnable_appExtensionHostRunMode" = 0; "param_runnable_productType" = "com.apple.product-type.application"; "param_structuredConsoleMode" = 1; "param_testing_launchedForTesting" = 0; "param_testing_suppressSimulatorApp" = 0; "param_testing_usingCLI" = 0; "sdk_canonicalName" = "iphoneos17.4"; "sdk_osVersion" = "17.4"; "sdk_variant" = iphoneos; } -- System Information macOS Version 14.0 (Build 23A344) Xcode 15.3 (22618) (Build 15E204a) Timestamp: 2024-03-18T21:12:00+01:00
1
0
5.3k
Mar ’24
Widgets: Detect StandBy night mode iOS 17
How can I detect the StandBy mode on iOS 17? When my widget is used in StandBy mode, the background is removed thanks to this method: .containerBackground(for: .widget) { myBackgroundImage() } This is very useful when my small widget is displayed on the iPad Lockscreen in landscape mode for example. But to delimit my widget frame on the iPad lockscreen I set up an alternative light background this way: if widgetRenderingMode == .vibrant { Color.white.opacity(0.1).cornerRadius(cornerRadius) } My question: How to add the same alternative background when the widget is used in StandBy mode? In StandBy mode, widgetRenderingMode is equal to .fullColor like on the HomeScreen. But I want to be able to add this background only in standBy mode... Precision: containerBackground(for: .widget){} send it's content to the background of the container so I can't hide my light background behind it as it will always be in front wherever I put it...
4
2
3.3k
Nov ’23
WatchOS IntentTimelineProvider recommendations
Hi! I have an Apple Watch app that provide widgets (circular, corners and InLine) to my users. I use the IntentTimelineProvider.recommendations method to provide the preconfigured widgets but only 16 first seems to be displayed. Is there an implicit limit of 16 items or I am doing something wrong? https://developer.apple.com/documentation/widgetkit/intenttimelineprovider/recommendations()-5ltr5
0
0
592
Sep ’23
iOS + WatchOS Build: How to automatize?
Hello, Have an iOS App with (extensionless) Watch App. Watch App is not a stand alone app. Watch App appears in the "Frameworks, Libraries & Embedded content" section of the iOS App Target. Nevertheless, I have to manually launch a build of the Watch App before building the iOS app if I want the build to succeed. Is there a way to automatize build in cascade (at least for release scheme and for "Archiving" ?
1
1
833
Sep ’23
iOS 17 Beta 3: Reaching Memory Limit (30MB) in Widget Extension
I don't know exactly why at the moment but it seems that my Widgets are triggering this 30MB memory limit more often since iOS 17 beta 3, causing a crash... Are any of you facing the same problem? From what I can analyze with "Instruments" there is no memory leak in my code, but sometimes there is a memory allocation peak which in some cases can exceed 30MB before returning around 15MB. My widgets extensively use images that are the size of the widget itself and I also sometimes need to compute images (crop/stretch and resize) on the fly when a widget reloads. With the arrival of Interactive Widgets, it might be time to raise this limit, right?
2
5
2.3k
Jul ’23
SVG Assets: Load Downsampled version in UIImage
Hi, I have some SVG assets that are natively in 512x512 resolution. I want to use 20 of them in a Widget context where memory consumption must be kept low (due to 30MB Memory limit in extensions). As in that widget context, the images are display in small size (they are displayed in full size in the app) I would like to load a downsampled version of the images (let say 32x32). Is there any way to achieve that? (perhaps with configuration or traitCollection) I could resize them after having loading them full size but it will nevertheless create a memory peak consumption while resizing all the images... Thanks in advance for the help. PS: I really want to avoid to generate smaller preview images just for that purpose but if I can't find a better solution I could ask the app to generate thumbs for all images at first startup and use these thumbs in the widgets... Clement
0
0
1.3k
Jul ’23
iPhone 14 Pro (and 14 Pro Max) Native Screen Size
Hello Guys, When using Xcode 14 (RC or 14.0.1) the Native Screen size differ from simulator to real device for the brand new iPhone 14 Pro and Pro Max causing my apps some bugs (because using the real device screen size for some computations). Just after app launch: log.info("Canevas Size: \(UIScreen.main.bounds.width) x \(UIScreen.main.bounds.height)") log.info("Native Size: \(UIScreen.main.nativeBounds.width) x \(UIScreen.main.nativeBounds.height)") Result iPhone 14 Pro (Simulator Output): Canevas Size: 393.0 x 852.0 Native Size: 1179.0 x 2556.0 iPhone 14 Pro (Real Device): Canevas Screen Size: 390.0 x 844.0 Native Screen Size: 1170.0 x 2532.0 Does anyone reproduce that? I do not own myself a real iPhone 14 Pro and can't investigate any further sadly. Do you know how I can get the real screensize in pixels?
4
3
7.7k
Sep ’22
Widget Extension built with Xcode 14.0 beta 4 Crashes immediately on iOS 15 or earlier (EXC_BREAKPOINT code=1, subcode=0x187e48e60) causing blank widget
Hello, My app that has a Widget extension was working fine when built with Xcode 13. With Xcode 14.0 beta 3 and 4, the widget app extension works fine on iOS 16 but crashed on iOS 15 and lower. The widgets become blank. Here are the crash logs. Crash seems to be located in PluginKit / WidgetKit libs. I am pretty sure that it is linked to a reference to something that is present on iOS 16 but not on iOS 15 and earlier, but can't figure what... Widget 28-07-2022 13-25.crash Incident Identifier: E64B3B90-5FEC-415D-93B7-7C85B60A1272 CrashReporter Key: 2459bfa2a6c63e93eaf5daed8b12161062f537f9 Hardware Model: iPhone10,6 Process: Widget [926] Path: /private/var/containers/Bundle/Application/188DC7BF-96B3-4266-AB0D-C43094F87394/App.app/PlugIns/Widget.appex/Widget Identifier: com.xxxxxxx.yyyyyyyyy.Widget Version: 1.2.3 (91) Code Type: ARM-64 (Native) Role: Background Parent Process: launchd [1] Coalition: com.xxxxxxx.yyyyyyyyy.Widget [703] Date/Time: 2022-07-28 13:25:21.9986 +0200 Launch Time: 2022-07-28 13:25:21.9370 +0200 OS Version: iPhone OS 15.5 (19F5062g) Release Type: Beta Baseband Version: 5.03.01 Report Version: 104 Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x0000000187e4bc20 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [926] Triggered by Thread: 0 Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 WidgetKit 0x187e4bc20 0x187dd3000 + 494624 1 WidgetKit 0x187e4bc04 0x187dd3000 + 494596 2 WidgetKit 0x187de2858 0x187dd3000 + 63576 3 libdispatch.dylib 0x180547094 _dispatch_call_block_and_release + 24 4 libdispatch.dylib 0x180548094 _dispatch_client_callout + 16 5 libdispatch.dylib 0x180529858 _dispatch_main_queue_drain + 888 6 libdispatch.dylib 0x1805294d0 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 36 7 CoreFoundation 0x1808430c4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 8 CoreFoundation 0x1808005e8 __CFRunLoopRun + 2544 9 CoreFoundation 0x180813240 CFRunLoopRunSpecific + 572 10 Foundation 0x181f22efc -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 232 11 Foundation 0x181f23670 -[NSRunLoop(NSRunLoop) run] + 88 12 libxpc.dylib 0x1dba26f74 _xpc_objc_main + 532 13 libxpc.dylib 0x1dba2912c xpc_main + 152 14 Foundation 0x181f6914c -[NSXPCListener resume] + 292 15 PlugInKit 0x1be0db804 0x1be0bf000 + 116740 16 PlugInKit 0x1be0c5f18 0x1be0bf000 + 28440 17 PlugInKit 0x1be0c4f74 0x1be0bf000 + 24436 18 ExtensionFoundation 0x1c9e083bc EXExtensionMain + 296 19 Foundation 0x181fc85ac NSExtensionMain + 216 20 dyld 0x105f003d0 start + 444 Thread 1: 0 libsystem_pthread.dylib 0x1db9f3934 start_wqthread + 0 Thread 2 name: Dispatch queue: com.apple.NSXPCConnection.user.endpoint Thread 2: 0 libobjc.A.dylib 0x197fd2cf4 objc_msgSend + 20 1 Foundation 0x181f3bc04 -[NSKeyedUnarchiver _validatePropertyListClass:forKey:] + 76 2 Foundation 0x181f4001c _decodeObjectBinary + 504 ... Help appreciated! Thanks. Clement
1
2
1.1k
Jul ’22
GKMatch: GameKitServices crashes in GCKSessionReceiveDOOB on the second real-time match — the finished session is never reclaimed
We ship a two-player real-time GameKit game. On iOS 27 the app crashes inside GameKitServices on the second real-time match of any app session — nine times out of nine yesterday. Filed as FB24789094 (and FB24788999 for a separate reinvitation problem). Posting the measurements here because the unified log makes the mechanism visible, and because everything I tried at the app level failed — maybe somebody has the missing piece. THE CRASH Main thread, no application frame anywhere on the stack: CFRetain + 52 GCKSessionReceiveDOOB + 1632 -[GKSessionInternal receiveDOOB:fromPeer:inSession:context:] + 320 -[GKSessionInternal(_private) tellDelegate_didReceiveBand_RetryICE:] + 212 __NSThreadPerformPerform + 264 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ EXC_BAD_ACCESS (SIGBUS), EXC_ARM_DA_ALIGN at 0x9 (0xa in one report). In every report the faulting address is exactly x0 + 8, and x0 is 1 or 2 — CFRetain is handed a small integer, not a pointer. A use-after-free would fault on a large plausible-looking address; 1 and 2 are not addresses at all. Address Sanitizer agrees: no heap error is reported before the fault, only __asan::ReportDeadlySignal directly above the same three GameKitServices frames. It reads like type confusion in the RetryICE band path. Not the SDK: a build made with Xcode 26.6 against iphoneos26.5 crashes identically — same stack, same registers. The peer's OS does not matter either (iPadOS 17.7.11, iOS 26.6.1 and iOS 27.0 all seen on the other side, and in one case an older build of our own app). Only the crashing device is always on iOS 27.0 (24A435), an iPhone 15 Pro. RECIPE Two devices, two Game Center accounts. Form a two-player real-time GKMatch — GKMatchmaker.findMatch(for:) or an invitation, both reproduce. Wait for the peer to connect, call finishMatchmaking(for:). Play for ten seconds or so, so data really flows. End it: match.disconnect(), release the GKMatch. In the SAME process, form a SECOND real-time match. Play. The crash lands roughly ten to thirty seconds after the second match starts exchanging data. A first match in a freshly launched process has never crashed for us. Out of eleven app sessions that reached a second match, two were force quit by hand during other tests and the remaining nine all crashed here. THE SESSION IS NEVER RECLAIMED GameKit runs one "com.apple.gamekitservices.gcksession.recvproc" / "sendproc" thread pair per live real-time session, in the app's own process. You can count them from inside the app, which turns out to be the only way to see what is going on: var threads: thread_act_array_t? var count: mach_msg_type_number_t = 0 task_threads(mach_task_self_, &threads, &count) // then pthread_from_mach_thread_np(threads[i]) + pthread_getname_np, and compare the name Measured across one app session: after Game Center authentication, before any match ......... 0 first match live ........................................... 1 right after match.disconnect() returns ..................... 1 <- not reclaimed before the second match is adopted ......................... 2 right after the second match's disconnect() ................ 2 Every crash report shows two of those pairs alive, although the app holds exactly one GKMatch at a time and releases the finished one the instant disconnect() returns. The same leak is visible on iOS 26.6.1 (an iPhone 11 Pro leaks identically) — it just does not crash there. WHAT THE LEFTOVER SESSION DOES Each match gets its own CDXClient. The first match's is never torn down, and keeps poking its hole on a 30-second keep-alive, on the same local port (:16402) the second match then binds: 15:28:05.117 <CDXClient: 0x155872e40> requesting-hole-punch <- match 1 15:28:35.289 <CDXClient: 0x155872e40> requesting-hole-punch <- match 1, +30s, match already over 15:28:50.197 <CDXClient: 0x12d4bda40> requesting-hole-punch <- match 2 15:29:05.287 <CDXClient: 0x155872e40> requesting-hole-punch <- match 1 again, 4s before the crash GCKSessionCreate:6425 globalscopelaunch appears once per process; the second match only does 6509 globalscoperequest and reuses the global scope. During the second match's ICE setup a packet arrives belonging to no live session: -[CDXClient handleFDEvent]:1066 packet-from-unknown-session -[CDXClient handleFDEvent]:1067 Incoming packet from unknown session. SID = ... immediately followed by [ERROR] ICEStopConnectivityCheck:2763 ICEStopConnectivityCheck() found no ICE check with call id (...) [ERROR] gckSessionCheckPendingConnections:1545 iICEChecksLeft=0, iUnconnectedNodeCount=0, iDDsExpected=1 Those lines appear exactly three times in a 28-minute window, all three in the two processes that went on to crash, never during a first match. About fourteen seconds later the RetryICE band is delivered and CFRetain is called on the garbage. WHAT DID NOT WORK Releasing the GKMatch immediately after disconnect(). The session threads stay. Waiting. Gaps of 17, 19, 22, 25, 30 and 45 seconds between the two matches all crashed. Tearing the match down cleanly. I suspected that calling disconnect() while match.players was still non-empty was the trigger — five out of five such teardowns were followed by a crash. So I made the quitting side announce its departure, wait for match(_:player:didChange:) to report the peer gone, and only then disconnect. It works (disconnect now runs with players == 0) and it changes nothing: the count still reads 1 afterwards, and the next match still crashes. Worth saying explicitly, because the correlation was strong enough to look causal. Skipping finishMatchmaking(for:). No effect. The only thing that reliably avoids it is allowing a single real-time match per app launch, which is a poor thing to ship. QUESTIONS Is there a supported way to make GameKit release a finished GKMatch's session inside the process? A GKMatch that never connected (peer wait timed out, disconnect() on an empty match) appears to leave the same residue, so it is not about how the match ended. And has anyone else seen GCKSessionReceiveDOOB / tellDelegate_didReceiveBand_RetryICE? I could not find a single mention of these symbols anywhere.
Replies
2
Boosts
2
Views
878
Activity
1d
iOS 18.4 - HomeKit actions from AppIntent fail when triggered from Widget
Hi all, Since updating to iOS 18.4, I'm experiencing a regression with AppIntents triggered from Widgets. In my app, I use AppIntents inside a WidgetKit extension to control HomeKit devices. This setup was working perfectly up to iOS 18.3. However, starting with iOS 18.4, when the AppIntent is triggered from the widget and the main app is not running, the action fails with this error: Error Domain=HMErrorDomain Code=80 "Missing entitlement for API." UserInfo={ NSLocalizedFailureReason=Handler does not support background access, NSLocalizedDescription=Missing entitlement for API. } Interestingly, the exact same AppIntent works fine if the app is still alive in the background — it seems like the failure only occurs when the intent is handled by the widget process. This looks like a behavior change or new restriction introduced in iOS 18.4. Has anyone experienced the same? Is there a new entitlement needed, or a recommended workaround? Thanks in advance!
Replies
3
Boosts
2
Views
1.1k
Activity
Jun ’25
Interactive Widgets and Haptic feedback
With the new interactive widgets brought by iOS 17, is it possible to indicate that an action (button tap or toggle use) has been triggered by firing an Haptic feedback to the user?
Replies
3
Boosts
0
Views
2.0k
Activity
Apr ’24
Xcode 15: Disable the content margins for widget preview? (contentMarginsDisabled)
Hi guys, I am migrating my widgets to iOS 17 and because I already manage my layout margins, I just want to disable to new built-in widget content margins. I did it by using ".contentMarginsDisabled()" on the WidgetConfiguration and it works fine at run time. WIDGET CODE struct MyWidget: Widget { let kind: String = "MyWidget" var body: some WidgetConfiguration { return IntentConfiguration(kind: kind, intent: MyWidgetIntent.self, provider: WidgetProvider<MyWidgetIntent>()) { entry in WidgetView<MyWidgetIntent>(entry: entry) } .configurationDisplayName("My Widget") .supportedFamilies([WidgetFamily.systemMedium]) .contentMarginsDisabled() // <-- HERE } } RESULT Nevertheless, when previewing the WidgetView in a WidgetPreviewContext I didn't find anyway to disable the content margins (because manipulating directly the view and not a WidgetConfiguration). PREVIEW CODE struct MyWidget_Previews: PreviewProvider { static var previews: some View { WidgetView<MyWidgetIntent>(entry: WidgetEntry<MyWidgetIntent>()) // .padding(-16) Need to add this negative padding to disable margin .previewContext( WidgetPreviewContext(family: .systemMedium)) } } Do you know how to disable the content margins for widget preview?
Replies
2
Boosts
0
Views
3.9k
Activity
Mar ’24
Xcode 15.3 & iOS 17.4 app install issue: Framework is missing its bundle executable.
After updating Xcode to version 15.3, I can't install my app either on simulator or real device on iOS 17.4. Here is the error message I got when installing (Build succeed): Please try again later. `Framework is missing its bundle executable. Please check your build settings to make sure that a bundle executable is produced at the path 'MyApp.app/Frameworks/GoogleMobileAds.framework/GoogleMobileAds'` I don't have any issue when deploying on iOS 17.0.1, 17.2 or 17.3 on both sim and device. Does anyone face the same issue? Detail of the error: Impossible d’installer « My App » Domain: IXUserPresentableErrorDomain Code: 1 Recovery Suggestion: My App.app/Frameworks/GoogleMobileAds.framework is missing its bundle executable. Please check your build settings to make sure that a bundle executable is produced at the path "My App.app/Frameworks/GoogleMobileAds.framework/GoogleMobileAds". User Info: { DVTErrorCreationDateKey = "2024-03-18 20:12:00 +0000"; IDERunOperationFailingWorker = IDEInstallCoreDeviceWorker; } -- Impossible d’installer « My App » Domain: IXUserPresentableErrorDomain Code: 1 Recovery Suggestion: My App.app/Frameworks/GoogleMobileAds.framework is missing its bundle executable. Please check your build settings to make sure that a bundle executable is produced at the path "My App.app/Frameworks/GoogleMobileAds.framework/GoogleMobileAds". User Info: { IDERunOperationFailingWorker = IDEInstallCoreDeviceWorker; } -- Failed to install the app on the device. Domain: com.apple.dt.CoreDeviceError Code: 3002 User Info: { NSURL = "file:///Users/clement/Library/Developer/Xcode/DerivedData/MyApp-dwgovybwoaicqghaqtvbngdkplip/Build/Products/Debug-iphoneos/My%20App.app/"; } -- Impossible d’installer « My App » Domain: IXUserPresentableErrorDomain Code: 1 Failure Reason: Réessayez ultérieurement. Recovery Suggestion: My App.app/Frameworks/GoogleMobileAds.framework is missing its bundle executable. Please check your build settings to make sure that a bundle executable is produced at the path "My App.app/Frameworks/GoogleMobileAds.framework/GoogleMobileAds". -- My App.app/Frameworks/GoogleMobileAds.framework is missing its bundle executable. Please check your build settings to make sure that a bundle executable is produced at the path "My App.app/Frameworks/GoogleMobileAds.framework/GoogleMobileAds". Domain: MIInstallerErrorDomain Code: 71 User Info: { FunctionName = "-[MIExecutableBundle executableExistsWithError:]"; SourceFileLine = 1580; } -- lstat of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.cYcAbK/extracted/My App.app/Frameworks/GoogleMobileAds.framework/GoogleMobileAds failed: No such file or directory Domain: NSPOSIXErrorDomain Code: 2 Failure Reason: No such file or directory User Info: { FunctionName = "-[MIFileManager itemExistsAtURL:error:]"; SourceFileLine = 1340; } -- Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : { "device_isCoreDevice" = 1; "device_isWireless" = 1; "device_model" = "iPhone12,3"; "device_osBuild" = "17.4 (21E219)"; "device_platform" = "com.apple.platform.iphoneos"; "dvt_coredevice_version" = "355.24"; "dvt_mobiledevice_version" = "1643.100.58"; "launchSession_schemeCommand" = Run; "launchSession_state" = 1; "launchSession_targetArch" = arm64; "operation_duration_ms" = 10200; "operation_errorCode" = 1; "operation_errorDomain" = IXUserPresentableErrorDomain; "operation_errorWorker" = IDEInstallCoreDeviceWorker; "operation_name" = IDERunOperationWorkerGroup; "param_debugger_attachToExtensions" = 0; "param_debugger_attachToXPC" = 1; "param_debugger_type" = 3; "param_destination_isProxy" = 0; "param_destination_platform" = "com.apple.platform.iphoneos"; "param_diag_MainThreadChecker_stopOnIssue" = 0; "param_diag_MallocStackLogging_enableDuringAttach" = 0; "param_diag_MallocStackLogging_enableForXPC" = 1; "param_diag_allowLocationSimulation" = 1; "param_diag_checker_tpc_enable" = 1; "param_diag_gpu_frameCapture_enable" = 0; "param_diag_gpu_shaderValidation_enable" = 0; "param_diag_gpu_validation_enable" = 0; "param_diag_memoryGraphOnResourceException" = 0; "param_diag_queueDebugging_enable" = 1; "param_diag_runtimeProfile_generate" = 0; "param_diag_sanitizer_asan_enable" = 0; "param_diag_sanitizer_tsan_enable" = 0; "param_diag_sanitizer_tsan_stopOnIssue" = 0; "param_diag_sanitizer_ubsan_stopOnIssue" = 0; "param_diag_showNonLocalizedStrings" = 0; "param_diag_viewDebugging_enabled" = 1; "param_diag_viewDebugging_insertDylibOnLaunch" = 1; "param_install_style" = 0; "param_launcher_UID" = 2; "param_launcher_allowDeviceSensorReplayData" = 0; "param_launcher_kind" = 0; "param_launcher_style" = 99; "param_launcher_substyle" = 8192; "param_runnable_appExtensionHostRunMode" = 0; "param_runnable_productType" = "com.apple.product-type.application"; "param_structuredConsoleMode" = 1; "param_testing_launchedForTesting" = 0; "param_testing_suppressSimulatorApp" = 0; "param_testing_usingCLI" = 0; "sdk_canonicalName" = "iphoneos17.4"; "sdk_osVersion" = "17.4"; "sdk_variant" = iphoneos; } -- System Information macOS Version 14.0 (Build 23A344) Xcode 15.3 (22618) (Build 15E204a) Timestamp: 2024-03-18T21:12:00+01:00
Replies
1
Boosts
0
Views
5.3k
Activity
Mar ’24
Widgets: Detect StandBy night mode iOS 17
How can I detect the StandBy mode on iOS 17? When my widget is used in StandBy mode, the background is removed thanks to this method: .containerBackground(for: .widget) { myBackgroundImage() } This is very useful when my small widget is displayed on the iPad Lockscreen in landscape mode for example. But to delimit my widget frame on the iPad lockscreen I set up an alternative light background this way: if widgetRenderingMode == .vibrant { Color.white.opacity(0.1).cornerRadius(cornerRadius) } My question: How to add the same alternative background when the widget is used in StandBy mode? In StandBy mode, widgetRenderingMode is equal to .fullColor like on the HomeScreen. But I want to be able to add this background only in standBy mode... Precision: containerBackground(for: .widget){} send it's content to the background of the container so I can't hide my light background behind it as it will always be in front wherever I put it...
Replies
4
Boosts
2
Views
3.3k
Activity
Nov ’23
WatchOS IntentTimelineProvider recommendations
Hi! I have an Apple Watch app that provide widgets (circular, corners and InLine) to my users. I use the IntentTimelineProvider.recommendations method to provide the preconfigured widgets but only 16 first seems to be displayed. Is there an implicit limit of 16 items or I am doing something wrong? https://developer.apple.com/documentation/widgetkit/intenttimelineprovider/recommendations()-5ltr5
Replies
0
Boosts
0
Views
592
Activity
Sep ’23
iOS + WatchOS Build: How to automatize?
Hello, Have an iOS App with (extensionless) Watch App. Watch App is not a stand alone app. Watch App appears in the "Frameworks, Libraries & Embedded content" section of the iOS App Target. Nevertheless, I have to manually launch a build of the Watch App before building the iOS app if I want the build to succeed. Is there a way to automatize build in cascade (at least for release scheme and for "Archiving" ?
Replies
1
Boosts
1
Views
833
Activity
Sep ’23
iOS 17 Beta 3: Reaching Memory Limit (30MB) in Widget Extension
I don't know exactly why at the moment but it seems that my Widgets are triggering this 30MB memory limit more often since iOS 17 beta 3, causing a crash... Are any of you facing the same problem? From what I can analyze with "Instruments" there is no memory leak in my code, but sometimes there is a memory allocation peak which in some cases can exceed 30MB before returning around 15MB. My widgets extensively use images that are the size of the widget itself and I also sometimes need to compute images (crop/stretch and resize) on the fly when a widget reloads. With the arrival of Interactive Widgets, it might be time to raise this limit, right?
Replies
2
Boosts
5
Views
2.3k
Activity
Jul ’23
SVG Assets: Load Downsampled version in UIImage
Hi, I have some SVG assets that are natively in 512x512 resolution. I want to use 20 of them in a Widget context where memory consumption must be kept low (due to 30MB Memory limit in extensions). As in that widget context, the images are display in small size (they are displayed in full size in the app) I would like to load a downsampled version of the images (let say 32x32). Is there any way to achieve that? (perhaps with configuration or traitCollection) I could resize them after having loading them full size but it will nevertheless create a memory peak consumption while resizing all the images... Thanks in advance for the help. PS: I really want to avoid to generate smaller preview images just for that purpose but if I can't find a better solution I could ask the app to generate thumbs for all images at first startup and use these thumbs in the widgets... Clement
Replies
0
Boosts
0
Views
1.3k
Activity
Jul ’23
iPhone 14 Pro (and 14 Pro Max) Native Screen Size
Hello Guys, When using Xcode 14 (RC or 14.0.1) the Native Screen size differ from simulator to real device for the brand new iPhone 14 Pro and Pro Max causing my apps some bugs (because using the real device screen size for some computations). Just after app launch: log.info("Canevas Size: \(UIScreen.main.bounds.width) x \(UIScreen.main.bounds.height)") log.info("Native Size: \(UIScreen.main.nativeBounds.width) x \(UIScreen.main.nativeBounds.height)") Result iPhone 14 Pro (Simulator Output): Canevas Size: 393.0 x 852.0 Native Size: 1179.0 x 2556.0 iPhone 14 Pro (Real Device): Canevas Screen Size: 390.0 x 844.0 Native Screen Size: 1170.0 x 2532.0 Does anyone reproduce that? I do not own myself a real iPhone 14 Pro and can't investigate any further sadly. Do you know how I can get the real screensize in pixels?
Replies
4
Boosts
3
Views
7.7k
Activity
Sep ’22
Widget Extension built with Xcode 14.0 beta 4 Crashes immediately on iOS 15 or earlier (EXC_BREAKPOINT code=1, subcode=0x187e48e60) causing blank widget
Hello, My app that has a Widget extension was working fine when built with Xcode 13. With Xcode 14.0 beta 3 and 4, the widget app extension works fine on iOS 16 but crashed on iOS 15 and lower. The widgets become blank. Here are the crash logs. Crash seems to be located in PluginKit / WidgetKit libs. I am pretty sure that it is linked to a reference to something that is present on iOS 16 but not on iOS 15 and earlier, but can't figure what... Widget 28-07-2022 13-25.crash Incident Identifier: E64B3B90-5FEC-415D-93B7-7C85B60A1272 CrashReporter Key: 2459bfa2a6c63e93eaf5daed8b12161062f537f9 Hardware Model: iPhone10,6 Process: Widget [926] Path: /private/var/containers/Bundle/Application/188DC7BF-96B3-4266-AB0D-C43094F87394/App.app/PlugIns/Widget.appex/Widget Identifier: com.xxxxxxx.yyyyyyyyy.Widget Version: 1.2.3 (91) Code Type: ARM-64 (Native) Role: Background Parent Process: launchd [1] Coalition: com.xxxxxxx.yyyyyyyyy.Widget [703] Date/Time: 2022-07-28 13:25:21.9986 +0200 Launch Time: 2022-07-28 13:25:21.9370 +0200 OS Version: iPhone OS 15.5 (19F5062g) Release Type: Beta Baseband Version: 5.03.01 Report Version: 104 Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x0000000187e4bc20 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [926] Triggered by Thread: 0 Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 WidgetKit 0x187e4bc20 0x187dd3000 + 494624 1 WidgetKit 0x187e4bc04 0x187dd3000 + 494596 2 WidgetKit 0x187de2858 0x187dd3000 + 63576 3 libdispatch.dylib 0x180547094 _dispatch_call_block_and_release + 24 4 libdispatch.dylib 0x180548094 _dispatch_client_callout + 16 5 libdispatch.dylib 0x180529858 _dispatch_main_queue_drain + 888 6 libdispatch.dylib 0x1805294d0 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 36 7 CoreFoundation 0x1808430c4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 8 CoreFoundation 0x1808005e8 __CFRunLoopRun + 2544 9 CoreFoundation 0x180813240 CFRunLoopRunSpecific + 572 10 Foundation 0x181f22efc -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 232 11 Foundation 0x181f23670 -[NSRunLoop(NSRunLoop) run] + 88 12 libxpc.dylib 0x1dba26f74 _xpc_objc_main + 532 13 libxpc.dylib 0x1dba2912c xpc_main + 152 14 Foundation 0x181f6914c -[NSXPCListener resume] + 292 15 PlugInKit 0x1be0db804 0x1be0bf000 + 116740 16 PlugInKit 0x1be0c5f18 0x1be0bf000 + 28440 17 PlugInKit 0x1be0c4f74 0x1be0bf000 + 24436 18 ExtensionFoundation 0x1c9e083bc EXExtensionMain + 296 19 Foundation 0x181fc85ac NSExtensionMain + 216 20 dyld 0x105f003d0 start + 444 Thread 1: 0 libsystem_pthread.dylib 0x1db9f3934 start_wqthread + 0 Thread 2 name: Dispatch queue: com.apple.NSXPCConnection.user.endpoint Thread 2: 0 libobjc.A.dylib 0x197fd2cf4 objc_msgSend + 20 1 Foundation 0x181f3bc04 -[NSKeyedUnarchiver _validatePropertyListClass:forKey:] + 76 2 Foundation 0x181f4001c _decodeObjectBinary + 504 ... Help appreciated! Thanks. Clement
Replies
1
Boosts
2
Views
1.1k
Activity
Jul ’22