Alamofire: Alamofire 5.2.2 TestFlight watchOS build crashes on Apple Watch Series 3 devices (32-bit) (Bitcode related?)

What did you do?

Hello!

I have a WatchOS Application on TestFlight that is crashing on startup on Apple Watch Series 3 devices (32-bit). It works flawlessly on Simulators (Xcode 11.7) and Apple Watch Series 4.

I am using Alamofire 5.2.2 with Swift Package Manager. Latest Xcode (version 11.7). The device is Apple Watch Series 3 devices (32-bit) running latest final watchOS (version 6.2.8). Can you help me or give some direction on what is happening here?

I am calling a REST service that returns a JSON error file (response) and HTTP status code 401 (Unauthorized) if no gateway access token is given.

As I said this works in simulator and Apple Watch Series 4 device. I suspect of Bitcode, as in the past versions I had an iOS companion app and disabled bitcode generation, but now we only have the watch app and I cannot disable Bitcode generation.

What did you expect to happen?

Handles the 401 error, calls interceptor, call login again and gracefully logins the user.

What happened instead?

The crash is somewhat like this:

Hardware Model:      Watch3,4
Process:             Watch App Extension [616]
Version:             132 (1.0)
AppVariant:          1:Watch3,4:6
Beta:                YES
Code Type:           ARM (Native)
Role:                Foreground
Parent Process:      launchd [1]

Date/Time:           2020-09-02 15:52:50.8659 -0300
Launch Time:         2020-09-02 15:52:48.0000 -0300
OS Version:          Watch OS 6.2.8 (17U63)
Release Type:        User
Baseband Version:    n/a
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000060
VM Region Info: 0x60 is not in any region.  Bytes before following region: 2310048
      REGION TYPE              START - END     [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                 00234000-0038c000 [ 1376K] r-x/r-x SM=COW  ...App Extension

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [616]
Triggered by Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libswiftCore.dylib            	0x6f7f4060 static _SetStorage.allocate+ 864352 (scale:age:seed:) + 16
1   libswiftCore.dylib            	0x6f7f007e static _SetStorage.allocate+ 847998 (capacity:) + 126
2   Watch App Extension	0x002fcca4 specialized protocol witness for Collection.endIndex.getter in conformance [A] + 822436 (_$s30Watch_App_Extension12SimulaCambioMp:0)
3   Watch App Extension	0x002ebcfe static ResponseSerializer.defaultEmptyRequestMethods.getter + 752894 (contaFormatada.modify:102)
4   Watch App Extension	0x002801e2 AlamofireLoginService.loginSmartwatch(completion:) + 311778 (AlamofireLoginService.swift:49)
5   Watch App Extension	0x0027b568 specialized InterfaceController.doLogin(:semProgresso:) + 292200 (InterfaceController.swift:0)
6   Watch App Extension	0x00275ec6 InterfaceController.awake(withContext:) + 270022 (InterfaceController.swift:246)
7   Watch App Extension	0x00276888 @objc InterfaceController.awake(withContext:) + 272520 (<compiler-generated>:0
8   WatchKit                      	0x5f1959c2 _WKInterfaceControllerCreateClass + 444
9   WatchKit                      	0x5f1ceef4 __153-[SPRemoteInterface createViewController:className:properties:contextID:info:gestureDescriptions:clientIdentifier:interfaceControllerCreationCompletion:]_block_invoke_3 + 348
10  WatchKit                      	0x5f1cebbe __153-[SPRemoteInterface createViewController:className:properties:contextID:info:gestureDescriptions:clientIdentifier:interfaceControllerCreationCompletion:]_block_invoke_2 + 1070
11  WatchKit                      	0x5f194130 spUtils_dispatchAsyncToMainThread + 22
12  WatchKit                      	0x5f1ce75c __153-[SPRemoteInterface createViewController:className:properties:contextID:info:gestureDescriptions:clientIdentifier:interfaceControllerCreationCompletion:]_block_invoke + 156
13  WatchKit                      	0x5f1956c4 -[SPRemoteInterface performAfterApplicationDidFinishLaunching:] + 40
14  WatchKit                      	0x5f195410 -[SPRemoteInterface createViewController:className:properties:contextID:info:gestureDescriptions:clientIdentifier:interfaceControllerCreationCompletion:] + 282
15  WatchKit                      	0x5f23564a __178-[SPExtensionConnection interfaceViewController:createCompanionControllerClass:properties:initializationContextID:info:gestureDescriptions:interfaceControllerCreationCompletion:]_block_invoke + 294
16  WatchKit                      	0x5f192ba2 -[SPExtensionConnection performOnSendQueue:syncIfUnsuspended:] + 464
17  WatchKit                      	0x5f195298 -[SPExtensionConnection interfaceViewController:createCompanionControllerClass:properties:initializationContextID:info:gestureDescriptions:interfaceControllerCreationCompletion:] + 284
18  WatchKit                      	0x5f1950f4 -[SPApplicationDelegate viewController:createWKInterfaceControllerClass:properties:contextID:creationCompletion:] + 1588
19  WatchKit                      	0x5f183740 -[SPInterfaceViewController loadView] + 2004
20  UIKitCore                     	0x678d7aca -[UIViewController loadViewIfRequired] + 160
21  UIKitCore                     	0x678d80f0 -[UIViewController view] + 24
22  WatchKit                      	0x5f182536 -[SPInterfaceViewController applicationDidBecomeActive] + 126
23  WatchKit                      	0x5f182024 -[SPApplicationDelegate applicationDidBecomeActive:] + 670
24  UIKitCore                     	0x67d6dc9a -[UIApplication _stopDeactivatingForReason:] + 1150
25  UIKitCore                     	0x6772463e -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 414
26  UIKitCore                     	0x677248f0 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 632
27  UIKitCore                     	0x677242d6 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 266
28  UIKitCore                     	0x67727d88 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke_2 + 162
29  UIKitCore                     	0x679f8238 +[BSAnimationSettings+ 4551224 (UIKit) tryAnimatingWithSettings:actions:completion:] + 746
30  UIKitCore                     	0x67ab8a1c _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 230
31  UIKitCore                     	0x67727ba8 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 116
32  UIKitCore                     	0x67ab892c _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 78
33  UIKitCore                     	0x67727a4c -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 296
34  UIKitCore                     	0x675d7bd2 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 578
35  UIKitCore                     	0x675d6b48 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 190
36  UIKitCore                     	0x675d795c -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 158
37  UIKitCore                     	0x67a1480e -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 406
38  PepperUICore                  	0x59fc7e62 -[PUICApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 642
39  CarouselUIServices            	0x5d67f498 -[CUISWatchKitApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 220
40  FrontBoardServices            	0x52fa4b5c -[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:] + 510
41  FrontBoardServices            	0x52fc3396 __88-[FBSWorkspaceScenesClient sceneID:updateWithSettingsDiff:transitionContext:completion:]_block_invoke_2 + 104
42  FrontBoardServices            	0x52fad00c -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 204
43  FrontBoardServices            	0x52fc32f8 __88-[FBSWorkspaceScenesClient sceneID:updateWithSettingsDiff:transitionContext:completion:]_block_invoke + 154
44  libdispatch.dylib             	0x4f882e1e _dispatch_client_callout + 6
45  libdispatch.dylib             	0x4f88507a _dispatch_block_invoke_direct + 180
46  FrontBoardServices            	0x52fe1748 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 22
47  FrontBoardServices            	0x52fe152e -[FBSSerialQueue _queue_performNextIfPossible] + 346
48  FrontBoardServices            	0x52fe1926 -[FBSSerialQueue _performNextFromRunLoopSource] + 24
49  CoreFoundation                	0x4fd0696e __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
50  CoreFoundation                	0x4fd068c4 __CFRunLoopDoSource0 + 84
51  CoreFoundation                	0x4fd062d6 __CFRunLoopDoSources0 + 200
52  CoreFoundation                	0x4fd02264 __CFRunLoopRun + 732
53  CoreFoundation                	0x4fd01cec CFRunLoopRunSpecific + 326
54  GraphicsServices              	0x52b6bd3c GSEventRunModal + 132
55  UIKitCore                     	0x67d7736e UIApplicationMain + 1720
56  libxpc.dylib                  	0x4faa3f0c _xpc_objc_main.cold.3 + 152
57  libxpc.dylib                  	0x4fa94e8c _xpc_objc_main + 184
58  libxpc.dylib                  	0x4fa96ae8 xpc_main + 110
59  Foundation                    	0x50617090 +[NSXPCListener serviceListener] + 0
60  PlugInKit                     	0x577f0392 0x577de000 + 74642
61  WatchKit                      	0x5f18faf0 WKExtensionMain + 62
62  libdyld.dylib                 	0x4f8bd7b2 start + 2

Thread 1:
0   libsystem_pthread.dylib       	0x4fa5bf24 start_wqthread + 0

Thread 2:
0   libsystem_pthread.dylib       	0x4fa5bf24 start_wqthread + 0

Thread 3:
0   libsystem_pthread.dylib       	0x4fa5bf24 start_wqthread + 0

Thread 4 name:  com.apple.uikit.eventfetch-thread
Thread 4:
0   libsystem_kernel.dylib        	0x4f9c76a8 mach_msg_trap + 20
1   libsystem_kernel.dylib        	0x4f9c6d7a mach_msg + 42
2   CoreFoundation                	0x4fd06390 __CFRunLoopServiceMachPort + 106
3   CoreFoundation                	0x4fd0238a __CFRunLoopRun + 1026
4   CoreFoundation                	0x4fd01cec CFRunLoopRunSpecific + 326
5   Foundation                    	0x505e3a58 -[NSRunLoop+ 27224 (NSRunLoop) runMode:beforeDate:] + 180
6   Foundation                    	0x505e3974 -[NSRunLoop+ 26996 (NSRunLoop) runUntilDate:] + 76
7   UIKitCore                     	0x67df5f18 -[UIEventFetcher threadMain] + 140
8   Foundation                    	0x506e4308 __NSThread__start__ + 708
9   libsystem_pthread.dylib       	0x4fa55236 _pthread_start + 130
10  libsystem_pthread.dylib       	0x4fa5bf50 thread_start + 20

Thread 5:
0   libsystem_pthread.dylib       	0x4fa5bf24 start_wqthread + 0

Thread 6:
0   libsystem_pthread.dylib       	0x4fa5bf24 start_wqthread + 0

Thread 7:
0   libsystem_pthread.dylib       	0x4fa5bf24 start_wqthread + 0

Thread 8 name:  Dispatch queue: com.apple.NSXPCConnection.m-user.com.apple.nsurlsessiond.NSURLSessionProxyService
Thread 8:
0   libsystem_kernel.dylib        	0x4f9e0bac kevent_id + 24
1   libdispatch.dylib             	0x4f89aec8 _dispatch_kq_poll + 144
2   libdispatch.dylib             	0x4f89a73a _dispatch_event_loop_poke + 650
3   libdispatch.dylib             	0x4f889dee _dispatch_queue_wakeup + 354
4   CFNetwork                     	0x5044ee96 0x502f6000 + 1412758
5   CoreFoundation                	0x4fd6f564 __invoking___ + 84
6   CoreFoundation                	0x4fc83cf6 -[NSInvocation invoke] + 274
7   Foundation                    	0x507c00bc __NSXPCCONNECTION_IS_CALLING_OUT_TO_EXPORTED_OBJECT__ + 22
8   Foundation                    	0x506256fc -[NSXPCConnection _decodeAndInvokeMessageWithEvent:flags:] + 1168
9   Foundation                    	0x507c01e0 message_handler + 196
10  libxpc.dylib                  	0x4fa8f730 _xpc_connection_call_event_handler + 36
11  libxpc.dylib                  	0x4fa8fa04 _xpc_connection_mach_event + 716
12  libdispatch.dylib             	0x4f882e8c _dispatch_client_callout4 + 8
13  libdispatch.dylib             	0x4f895cda _dispatch_mach_msg_invoke + 312
14  libdispatch.dylib             	0x4f887ca2 _dispatch_lane_serial_drain + 308
15  libdispatch.dylib             	0x4f8966a8 _dispatch_mach_invoke + 418
16  libdispatch.dylib             	0x4f887ca2 _dispatch_lane_serial_drain + 308
17  libdispatch.dylib             	0x4f888650 _dispatch_lane_invoke + 352
18  libdispatch.dylib             	0x4f890334 _dispatch_workloop_worker_thread + 508
19  libsystem_pthread.dylib       	0x4fa56cfc _pthread_wqthread + 204
20  libsystem_pthread.dylib       	0x4fa5bf38 start_wqthread + 20

Thread 9:
0   libsystem_pthread.dylib       	0x4fa5bf24 start_wqthread + 0

Thread 0 crashed with ARM Thread State (32-bit):
    r0: 0x00000001    r1: 0x00000000      r2: 0x00000001      r3: 0x00000000
    r4: 0x00000001    r5: 0x00000001      r6: 0x000000e4      r7: 0x27bcd708
    r8: 0x00000000    r9: 0x00000000     r10: 0x00000000     r11: 0x16db3fd0
    ip: 0xfff00000    sp: 0x27bcd670      lr: 0x6f7f007f      pc: 0x6f7f4060
  cpsr: 0x60000030

Binary Images:
0x234000 - 0x3d3fff Watch App Extension armv7k  <53780c55b55534578139202ab803cb6a> /var/containers/Bundle/Application/8D10BAB7-2EDF-4C98-8558-915BEBC0F499/Watch App.app/PlugIns/Watch App Extension.appex/Watch App Extension
0x504000 - 0x513fff libobjc-trampolines.dylib armv7k  <6ad2db0ce5f230ef93a1624440cf513a> /usr/lib/libobjc-trampolines.dylib
0x590000 - 0x5ebfff dyld armv7k  <3cbcec3e342e3bfab00f28eb029de430> /usr/lib/dyld
0x4f772000 - 0x4f775fff libSystem.B.dylib armv7k  <bfe605fff46e3cfe8397e37435e59490> /usr/lib/libSystem.B.dylib
0x4f776000 - 0x4f7b9fff libc++.1.dylib armv7k  <68da4f7256543e498f1e74e33a812556> /usr/lib/libc++.1.dylib
0x4f7ba000 - 0x4f7cdfff libc++abi.dylib armv7k  <1d210edc8eba3fcfa230d00b69cb680e> /usr/lib/libc++abi.dylib
0x4f7ce000 - 0x4f7f9fff libobjc.A.dylib armv7k  <0d9598610d3d3e1a8fe88321114d241b> /usr/lib/libobjc.A.dylib
0x4f7fa000 - 0x4f801fff libcache.dylib armv7k  <08fbf121eaf13f1da5f709956c6e2c70> /usr/lib/system/libcache.dylib
...
...
...

Alamofire Environment

Alamofire version: 5.2.2 Xcode version: 11.7 Swift version: Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53) Platform(s) running Alamofire: watchOS 6.2.8 (via TestFlight - bitcode enabled) macOS version running Xcode: macOS Catalina version 10.15.6 (19G2021)

Demo Project

Unfortunately this is a big project for a bank. I do not have yet a demo project because the error only occurs via TestFlight installing on Apple Watch Series 3 (32-bits).

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (10 by maintainers)

Most upvoted comments

Hey @jshier @mneves75, I am seeing the same issue on 5.2.2, Do you know if the issue is fixed in 5.4.1? Thanks

I had to rollback to Alamofire 4 and the problem went away. Did not tested it again with version 5. I recommend you open an Apple Feedback and write in their Developer forums.