iOS Payment SDK Sample app crashes on SPM

Hello,

I have downloaded the sample code from git and trying to run the Donut example. But gives error:
‘MockReaderUI’
‘SquareMobilePaymentsSDK’

so I tried to reset the package caches and add again the package but when I clicked on the add package Xcode crashed.

:waving_hand: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Configure the Reader SDK Sample Application
Configure the Reader SDK on iOS for Square Stand
Troubleshoot In-App Payments SDK Problems

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

Do you have the full error message or the crash log? Also is this in production or sandbox? :slight_smile:

Hi Bryan,

Sure I am attaching the log file. I am trying to add SDK in the Donut example.

Log:

Translated Report (Full Report Below)

Process: Xcode [1590]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 16.3 (23785)
Build Info: IDEApplication-23785000000000000~2 (16E140)
App Item ID: 497799835
App External ID: 873621200
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
User ID: 501

Date/Time: 2025-05-08 09:51:44.0786 -0700
OS Version: macOS 15.4.1 (24E263)
Report Version: 12
Anonymous UUID: 8BF781E9-7019-A742-C8DC-0485F5F831FF

Sleep/Wake UUID: 4B76AB70-99CE-433B-93A5-0B85FF574D45

Time Awake Since Boot: 10000 seconds
Time Since Wake: 1138 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6
Terminating Process: Xcode [1590]

Application Specific Information:
abort() called

Application Specific Signatures:
![requirement isEqual:[IDESourcePackageRequirement requirementUnversioned]]

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x196038388 __pthread_kill + 8
1 libsystem_pthread.dylib 0x19607188c pthread_kill + 296
2 libsystem_c.dylib 0x195f7ac60 abort + 124
3 IDEKit 0x1064d9740 +[IDEAssertionHandler _handleAssertionWithLogString:assertionSignature:assertionReason:extraBacktrace:] + 964
4 IDEKit 0x1064d9bb0 -[IDEAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] + 872
5 DVTFoundation 0x1024d695c _DVTAssertionHandler + 412
6 DVTFoundation 0x1024d6ac0 _DVTAssertionFailureHandler + 196
7 IDEFoundation 0x10b7cff14 -[IDESourcePackageReference initWithGitPackageRepositoryURL:requirement:].cold.1 + 60
8 IDEFoundation 0x10b029c30 -[IDESourcePackageReference initWithGitPackageRepositoryURL:requirement:] + 232
9 IDESwiftPackageUI 0x32ef2a9dc AvailablePackageOrigins.Origin.asSourcePackageReference(with:) + 264
10 IDESwiftPackageUI 0x32efbeb78 IDESwiftPackageChooseOptionsViewController.beginPreflight() + 364
11 IDESwiftPackageUI 0x32efbe9e4 IDESwiftPackageChooseOptionsViewController.viewDidAppear() + 368
12 IDESwiftPackageUI 0x32efbed18 @objc IDESwiftPackageChooseOptionsViewController.viewDidAppear() + 24
13 AppKit 0x199eaafe4 -[NSViewController _sendViewDidAppear] + 56
14 AppKit 0x19a8d753c -[NSView _windowDidOrderOnScreen] + 56
15 AppKit 0x19a8d75a8 -[NSView _windowDidOrderOnScreen] + 164
16 AppKit 0x19a8ed604 -[NSWindow _reallyDoOrderWindowAboveOrBelow:] + 1620
17 AppKit 0x19a8edf50 -[NSWindow _reallyDoOrderWindow:] + 64
18 AppKit 0x19a8ee1b0 -[NSWindow _doOrderWindow:] + 264
19 AppKit 0x199fd911c -[NSApplication _orderFrontModalWindow:relativeToWindow:] + 308
20 AppKit 0x19a01859c -[NSWindow _beginWindowBlockingModalSessionForSheet:service:completionHandler:isCritical:] + 1064
21 AppKit 0x19a6697e0 -[NSViewControllerSheetTransition animatePresentationOfViewController:fromViewController:] + 140
22 AppKit 0x19a4398cc -[NSViewController presentViewControllerAsSheet:] + 80
23 IDESwiftPackageUI 0x32efb07f0 IDESwiftPackageCollectionDetailViewController.addSelectedPackage() + 556
24 IDESwiftPackageUI 0x32efb048c <deduplicated_symbol> + 92
25 AppKit 0x199f4d040 -[NSApplication(NSResponder) sendAction:to:from:] + 560
26 IDEKit 0x1064d4030 __37-[IDEApplication sendAction:to:from:]_block_invoke + 272
27 DVTFoundation 0x1024d8560 DVTInvokeWithFailureHint + 76
28 IDEKit 0x1067ed358 -[IDEApplicationController application:setFailureHintMessage:duringBlock:] + 96
29 IDEKit 0x1064d4498 -[IDEApplication _invokeWithFailureHint:block:] + 92
30 IDEKit 0x1064d3eb0 -[IDEApplication sendAction:to:from:] + 284
31 AppKit 0x199f4cde0 -[NSControl sendAction:to:] + 72
32 AppKit 0x199f4cd24 __26-[NSCell _sendActionFrom:]_block_invoke + 100
33 AppKit 0x199f4cc4c -[NSCell _sendActionFrom:] + 204
34 AppKit 0x199f4cb48 -[NSButtonCell _sendActionFrom:] + 96
35 AppKit 0x199f4a0f4 NSControlTrackMouse + 1492
36 AppKit 0x199f49af4 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 144
37 AppKit 0x199f4996c -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 580
38 AppKit 0x199f48e18 -[NSControl mouseDown:] + 492
39 AppKit 0x199f47c74 -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 3664
40 AppKit 0x199ed3ce0 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 492
41 AppKit 0x199ed392c -[NSWindow(NSEventRouting) sendEvent:] + 288
42 AppKit 0x19a74b094 -[NSApplication(NSEventRouting) sendEvent:] + 1504
43 IDEKit 0x1064d3ca8 -[IDEApplication sendEvent:] + 236
44 AppKit 0x19a34a4a4 -[NSApplication _handleEvent:] + 60
45 AppKit 0x199da0c8c -[NSApplication run] + 520
46 IDEKit 0x1064d3ab8 -[IDEApplication run] + 192
47 AppKit 0x199d7735c NSApplicationMain + 880
48 dyld 0x195cd2b4c start + 6000

Thread 1:
0 libsystem_kernel.dylib 0x19602fc34 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x196042308 mach_msg2_internal + 76
2 libsystem_kernel.dylib 0x196038764 mach_msg_overwrite + 484
3 libsystem_kernel.dylib 0x19602ffa8 mach_msg + 24
4 CoreFoundation 0x19615cf8c __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x19615b8a8 __CFRunLoopRun + 1208
6 CoreFoundation 0x19615ad68 CFRunLoopRunSpecific + 572
7 Foundation 0x197443c78 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8 DTDeviceKitBase 0x1199f5930 +[DTDKRemoteDeviceConnection startServiceBrowsers] + 148
9 Foundation 0x19743dba8 NSThread__start + 732
10 libsystem_pthread.dylib 0x196071c0c _pthread_start + 136
11 libsystem_pthread.dylib 0x19606cb80 thread_start + 8

Thread 2:
0 libsystem_kernel.dylib 0x19602fc34 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x196042308 mach_msg2_internal + 76
2 libsystem_kernel.dylib 0x196038764 mach_msg_overwrite + 484
3 libsystem_kernel.dylib 0x19602ffa8 mach_msg + 24
4 CoreFoundation 0x19615cf8c __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x19615b8a8 __CFRunLoopRun + 1208
6 CoreFoundation 0x19615ad68 CFRunLoopRunSpecific + 572
7 Foundation 0x197443c78 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8 DTDeviceKitBase 0x1199fd45c -[DTDKRemoteDeviceDataListener listenerThreadImplementation] + 228
9 Foundation 0x19743dba8 NSThread__start + 732
10 libsystem_pthread.dylib 0x196071c0c _pthread_start + 136
11 libsystem_pthread.dylib 0x19606cb80 thread_start + 8

Thread 3:: com.apple.CFSocket.private
0 libsystem_kernel.dylib 0x19603ac2c __select + 8
1 CoreFoundation 0x196182e04 __CFSocketManager + 704
2 libsystem_pthread.dylib 0x196071c0c _pthread_start + 136
3 libsystem_pthread.dylib 0x19606cb80 thread_start + 8

Thread 4:: com.apple.NSEventThread
0 libsystem_kernel.dylib 0x19602fc34 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x196042308 mach_msg2_internal + 76
2 libsystem_kernel.dylib 0x196038764 mach_msg_overwrite + 484
3 libsystem_kernel.dylib 0x19602ffa8 mach_msg + 24
4 CoreFoundation 0x19615cf8c __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x19615b8a8 __CFRunLoopRun + 1208
6 CoreFoundation 0x19615ad68 CFRunLoopRunSpecific + 572
7 AppKit 0x199ed1818 _NSEventThread + 140
8 libsystem_pthread.dylib 0x196071c0c _pthread_start + 136
9 libsystem_pthread.dylib 0x19606cb80 thread_start + 8

Thread 5:: com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib 0x19602fc34 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x196042308 mach_msg2_internal + 76
2 libsystem_kernel.dylib 0x196038764 mach_msg_overwrite + 484
3 libsystem_kernel.dylib 0x19602ffa8 mach_msg + 24
4 CoreFoundation 0x19615cf8c __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x19615b8a8 __CFRunLoopRun + 1208
6 CoreFoundation 0x19615ad68 CFRunLoopRunSpecific + 572
7 CFNetwork 0x19bb926a0 +[__CFN_CoreSchedulingSetRunnable _run:] + 416
8 Foundation 0x19743dba8 NSThread__start + 732
9 libsystem_pthread.dylib 0x196071c0c _pthread_start + 136
10 libsystem_pthread.dylib 0x19606cb80 thread_start + 8

Thread 6:: Connection::RunLoop() packet reading thread
0 libsystem_kernel.dylib 0x1960307dc read + 8
1 LLDBRPC 0x11ca82054 rpc_common::RPCConnectionSocket::Read(std::__1::vector<unsigned char, std::__1::allocator>&, bool) + 140
2 LLDBRPC 0x11ca7d0c4 rpc_common::Connection::ReceivePacket(rpc_common::RPCPacket&) + 180
3 LLDBRPC 0x11ca7cf00 rpc_common::Connection::RunLoop() + 184
4 LLDBRPC 0x11ca81164 void* std::__1::__thread_proxy[abi:nn190102]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct>, rpc_common::Connection::AdoptUnixSocket(int)::$_0>>(void*) + 44
5 libsystem_pthread.dylib 0x196071c0c _pthread_start + 136
6 libsystem_pthread.dylib 0x19606cb80 thread_start + 8

Thread 7:: IOReader::ReadThread() for fd 58
0 libsystem_kernel.dylib 0x19603ac2c __select + 8
1 LLDBRPC 0x11ca79a4c IOReader::ReadThread(std::__1::function<bool (void const*, unsigned long)>) + 380
2 LLDBRPC 0x11ca79e80 void* std::__1::__thread_proxy[abi:nn190102]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct>, IOReader::StartReadThread(std::__1::function<bool (void const*, unsigned long)>)::$_0>>(void*) + 136
3 libsystem_pthread.dylib 0x196071c0c _pthread_start + 136
4 libsystem_pthread.dylib 0x19606cb80 thread_start + 8

Thread 8:
0 libsystem_kernel.dylib 0x196037204 __wait4 + 8
1 LLDBRPC 0x11ca7af7c PosixSpawn::ReapProcess(int, int*, int*) + 76
2 LLDBRPC 0x11ca815e4 void* std::__1::__thread_proxy[abi:nn190102]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct>, rpc_common::Connection::SpawnRPCServerProcess()::$_0>>(void*) + 64
3 libsystem_pthread.dylib 0x196071c0c _pthread_start + 136
4 libsystem_pthread.dylib 0x19606cb80 thread_start + 8

Thread 9:: NIO-ELT-0-#0
0 libsystem_kernel.dylib 0x196035d04 kevent + 8
1 XCResultKit 0x101a12324 specialized static KQueue.kevent(kq:changelist:nchanges:eventlist:nevents:timeout:) + 56
2 XCResultKit 0x1019f70e8 specialized Optional.withUnsafeOptionalPointer(:slight_smile: + 152
3 XCResultKit 0x1019f154c specialized Selector.whenReady0(strategy:onLoopBegin:
:slight_smile: + 336
4 XCResultKit 0x1019eca80 SelectableEventLoop.run() + 592
5 XCResultKit 0x1019d2e2c specialized static MultiThreadedEventLoopGroup.runTheLoop(thread:parentGroup:canEventLoopBeShutdownIndividually:selectorFactory:initializer:_:slight_smile: + 280
6 XCResultKit 0x1019d0808 closure #1 in static MultiThreadedEventLoopGroup.setupThreadAndEventLoop(name:parentGroup:selectorFactory:initializer:) + 136
7 XCResultKit 0x1019d3ef4 partial apply for closure #1 in static MultiThreadedEventLoopGroup.setupThreadAndEventLoop(name:parentGroup:selectorFactory:initializer:) + 36
8 XCResultKit 0x1019d61f4 thunk for @escaping @callee_guaranteed (@guaranteed NIOThread) → () + 24
9 XCResultKit 0x101a131f4 closure #1 in static ThreadOpsPosix.run(handle:args:detachThread:) + 348
10 libsystem_pthread.dylib 0x196071c0c _pthread_start + 136
11 libsystem_pthread.dylib 0x19606cb80 thread_start + 8

Thread 10:
0 libsystem_pthread.dylib 0x19606cb6c start_wqthread + 0

Thread 11:
0 libsystem_kernel.dylib 0x19602fc34 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x196042308 mach_msg2_internal + 76
2 libsystem_kernel.dylib 0x196038764 mach_msg_overwrite + 484
3 libsystem_kernel.dylib 0x19602ffa8 mach_msg + 24
4 CoreFoundation 0x19615cf8c __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x19615b8a8 __CFRunLoopRun + 1208
6 CoreFoundation 0x19615ad68 CFRunLoopRunSpecific + 572
7 CoreFoundation 0x1961d4864 CFRunLoopRun + 64
8 SwiftPM 0x1687218bc closure #1 in FSEventStream.start() + 224
9 SwiftPM 0x1686f8c78 closure #1 in Thread.init(task:) + 108
10 SwiftPM 0x1680b2f64 <deduplicated_symbol> + 28
11 SwiftPM 0x1686f8de0 @objc ThreadImpl.main() + 44
12 Foundation 0x19743dba8 NSThread__start + 732
13 libsystem_pthread.dylib 0x196071c0c _pthread_start + 136
14 libsystem_pthread.dylib 0x19606cb80 thread_start + 8

Thread 12:
0 libsystem_pthread.dylib 0x19606cb6c start_wqthread + 0

Thread 13:
0 libsystem_pthread.dylib 0x19606cb6c start_wqthread + 0

Thread 14:: JavaScriptCore libpas scavenger
0 libsystem_kernel.dylib 0x1960333cc __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1960720e0 _pthread_cond_wait + 984
2 JavaScriptCore 0x1b60bc288 scavenger_thread_main + 1584
3 libsystem_pthread.dylib 0x196071c0c _pthread_start + 136
4 libsystem_pthread.dylib 0x19606cb80 thread_start + 8

Thread 15:: WebCore: Scrolling
0 libsystem_kernel.dylib 0x19602fc34 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x196042308 mach_msg2_internal + 76
2 libsystem_kernel.dylib 0x196038764 mach_msg_overwrite + 484
3 libsystem_kernel.dylib 0x19602ffa8 mach_msg + 24
4 CoreFoundation 0x19615cf8c __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x19615b8a8 __CFRunLoopRun + 1208
6 CoreFoundation 0x19615ad68 CFRunLoopRunSpecific + 572
7 CoreFoundation 0x1961d4864 CFRunLoopRun + 64
8 JavaScriptCore 0x1b4ba4a08 WTF::Detail::CallableWrapper<WTF::RunLoop::create(WTF::ASCIILiteral, WTF::ThreadType, WTF::thread::QOS)::$_0, void>::call() + 52
9 JavaScriptCore 0x1b4bdbc08 WTF::thread::entryPoint(WTF::thread::NewThreadContext*) + 240
10 JavaScriptCore 0x1b49f2958 WTF::wtfThreadEntryPoint(void*) + 16
11 libsystem_pthread.dylib 0x196071c0c _pthread_start + 136
12 libsystem_pthread.dylib 0x19606cb80 thread_start + 8

Thread 16:
0 libsystem_pthread.dylib 0x19606cb6c start_wqthread + 0

Thread 17:
0 libsystem_pthread.dylib 0x19606cb6c start_wqthread + 0

Thread 18:
0 libsystem_pthread.dylib 0x19606cb6c start_wqthread + 0

Thread 19:
0 libsystem_pthread.dylib 0x19606cb6c start_wqthread + 0

Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000
x4: 0x000000016f3cd0a0 x5: 0x0000000000000001 x6: 0x0000000000000079 x7: 0x000000000000000a
x8: 0x265faf39294e6872 x9: 0x265faf3b2dba24f2 x10: 0x000060001510ebab x11: 0x000000000000000f
x12: 0x000000000000000b x13: 0x0000600001e63ea0 x14: 0x0100000205411585 x15: 0x0000000205411580
x16: 0x0000000000000148 x17: 0x0000000205fb4ac0 x18: 0x0000000000000000 x19: 0x0000000000000006
x20: 0x0000000000000103 x21: 0x0000000204f44d60 x22: 0x0000000107209c30 x23: 0x0000000000000000
x24: 0x0000000000000000 x25: 0x0000000000000000 x26: 0x00006000036e0440 x27: 0x00006000023e59c0
x28: 0x0000000204f465c8 fp: 0x000000016f3cdb10 lr: 0x000000019607188c
sp: 0x000000016f3cdaf0 pc: 0x0000000196038388 cpsr: 0x40001000
far: 0x0000000000000000 esr: 0x56000080 Address size fault

The crash log shows this is specifically a Swift Package Manager (SPM) issue within Xcode itself. Here’s why:

  1. The crash occurred in Xcode’s internal components:
IDEFoundation [...] -[IDESourcePackageReference initWithGitPackageRepositoryURL:requirement:]
IDESwiftPackageUI [...] AvailablePackageOrigins.Origin.asSourcePackageReference
  1. It happened during the package management UI flow, specifically when trying to add or modify a Swift package dependency in Xcode’s package manager interface.
  2. The crash signature specifically mentions package requirements:
![requirement isEqual:[IDESourcePackageRequirement requirementUnversioned]]

This is an Xcode internal issue related to package management, not a crash due to the SDK.

Based on the crash log, this Xcode crash appears to be related to Swift Package Manager integration. Here’s the key information and analysis:

  1. Crash Location and Type:
Exception Type: EXC_CRASH (SIGABRT)
Application Specific Signatures:
![requirement isEqual:[IDESourcePackageRequirement requirementUnversioned]]
  1. Relevant Stack Trace:
7 IDEFoundation 0x10b7cff14 -[IDESourcePackageReference initWithGitPackageRepositoryURL:requirement:].cold.1 + 60
8 IDEFoundation 0x10b029c30 -[IDESourcePackageReference initWithGitPackageRepositoryURL:requirement:] + 232
9 IDESwiftPackageUI 0x32ef2a9dc AvailablePackageOrigins.Origin.asSourcePackageReference(with:) + 264
10 IDESwiftPackageUI 0x32efbeb78 IDESwiftPackageChooseOptionsViewController.beginPreflight() + 364
  1. Root Cause: The crash occurred while trying to add a Swift Package dependency. Specifically, it happened during the package requirement validation phase when the user was attempting to add or modify a package in the Swift Package Manager interface.
  2. Suggested Solutions:

a) Immediate Fixes:

  • Close Xcode completely
  • Clear derived data:
rm -rf ~/Library/Developer/Xcode/DerivedData
  • Clear Swift Package Manager cache:
rm -rf ~/Library/Caches/org.swift.swiftpm

b) If the issue persists:

  1. Try adding the package manually in the Package.swift file
  2. Remove the package completely and re-add it
  3. Check if the package URL is valid and accessible
  4. Verify the package is compatible with your Swift version

c) Prevention Steps:

  • Keep Xcode updated to the latest version
  • Ensure you have stable internet connection when adding packages
  • Verify package requirements before adding them
  • Consider using exact version requirements instead of branch or commit requirements
  1. Additional Troubleshooting:
  • Check if the issue is specific to one package or occurs with all packages
  • Verify your Git credentials are properly configured
  • Check if you can access the package repository in a browser
  • Try adding the package in a new project to isolate the issue
    :slight_smile:

I created a test project and added SDK via pod. Now it’s working.

But the Donut sample still crashes at SPM.

Are you getting any crash logs from the sample app? :slight_smile:

Hi Brayn,

Yes as I mentioned above. It seems to be a Xcode issue as you said.