One of my projects (containing over 200 files in pure Swift) has just recently started interfering with the indexing process. The indexing process freezes midway and then stops abruptly, causing SourceKitService to crash.
I simply cannot find the faulty code; because there appears to be none!
My code compiles just fine (without a single warning!) - and yet it fails to be indexed. Initially, I thought it to be an Xcode 7.2 issue and so upgraded to the latest beta (7.3); however the issue still persists. I cannot revert back to my old code because too much work will be undone, and I can't spot a particular file to blame. The crash report is here.
To clarify, Xcode itself does not crash, only the indexing process (and SourceKitService as a consequence).
Any ideas on how to go about fixing this?
Remove "xcuserdata" from .xcodeproj (right click on .xcodeproj > select Show Package Contents. This should solve the problem.
If I'm reading properly,
the problem comes from this part of the process:
Thread 8 Crashed:
0 com.apple.SourceKitService 0x000000010450d9fc swift::TypeBase::getDesugaredType() + 12
1 com.apple.SourceKitService 0x00000001043bccbe (anonymous namespace)::DeclChecker::checkDynamicSelfReturn(swift::FuncDecl*, swift::TypeRepr*, unsigned int) + 478
2 com.apple.SourceKitService 0x00000001043b7c08 (anonymous namespace)::DeclChecker::visitFuncDecl(swift::FuncDecl*) + 1432
3 com.apple.SourceKitService 0x00000001043acc0d (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 2733
4 com.apple.SourceKitService 0x00000001043a7ea7 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 727
5 com.apple.SourceKitService 0x00000001043b6426 (anonymous namespace)::DeclChecker::visitSubscriptDecl(swift::SubscriptDecl*) + 1478
6 com.apple.SourceKitService 0x00000001043acbdd (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 2685
7 com.apple.SourceKitService 0x00000001043a7ea7 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 727
8 com.apple.SourceKitService 0x00000001044fc003 swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, unsigned int, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 3075
9 com.apple.SourceKitService 0x00000001043c7a7c swift::TypeChecker::lookupMember(swift::DeclContext*, swift::Type, swift::DeclName, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 556
10 com.apple.SourceKitService 0x00000001043d51b7 (anonymous namespace)::ConformanceChecker::lookupValueWitnesses(swift::ValueDecl*, bool*) + 359
11 com.apple.SourceKitService 0x00000001043d11a1 (anonymous namespace)::ConformanceChecker::resolveWitnessViaLookup(swift::ValueDecl*) + 401
12 com.apple.SourceKitService 0x00000001043ce86f swift::TypeChecker::checkConformance(swift::NormalProtocolConformance*) + 2255
13 com.apple.SourceKitService 0x000000010438011b typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) + 1099
14 com.apple.SourceKitService 0x00000001043809e5 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1781
15 com.apple.SourceKitService 0x0000000103fa40c2 swift::CompilerInstance::performSema() + 4738
16 com.apple.SourceKitService 0x0000000103e9a836 SourceKit::SwiftLangSupport::indexSource(llvm::StringRef, SourceKit::IndexingConsumer&, llvm::ArrayRef<char const*>, llvm::StringRef) + 4262
17 com.apple.SourceKitService 0x0000000103eb086a void SourceKit::WorkQueue::DispatchData::callAndDelete<handleRequestImpl(void*, std::__1::function<void (void*)>)::$_2>(void*) + 2170
18 libdispatch.dylib 0x00007fff9b7de33f _dispatch_client_callout + 8
19 libdispatch.dylib 0x00007fff9b7ec03a _dispatch_block_invoke + 474
20 com.apple.SourceKitService 0x00000001056afbbf executeBlock(void*) + 15
21 com.apple.SourceKitService 0x0000000103f3e58d ExecuteOnThread_Dispatch(void*) + 13
22 libsystem_pthread.dylib 0x00007fff8be14c13 _pthread_body + 131
23 libsystem_pthread.dylib 0x00007fff8be14b90 _pthread_start + 168
24 libsystem_pthread.dylib 0x00007fff8be12375 thread_start + 13
which leads us to :
https://github.com/apple/swift/pull/932/files
20days + ago
So I guess it's a known issue.
However I don't know what is causing it. I'm pretty sure it's a swift code style that is not well supported yet.
I also found your crash in this Crash test project:
https://github.com/practicalswift/swift-compiler-crashes
If you look into it, you might find the precise case that triggers one of those crashes:
✓ 28197 swift typebase getdesugaredtype
✓ 28200 swift typebase getdesugaredtype
✓ 28203 swift typebase getdesugaredtype
Related
I've just updated to Xcode 14, I compile my code with the -mcmodel=large flag.
This used to work on Xcode 13, but since the upgrade I get the following error:
0 0x104a141a0 __assert_rtn + 140
1 0x104a1d2ec ld::tool::SymbolTableAtom<arm64>::classicOrdinalForProxy(ld::Atom const*) (.cold.2) + 0
2 0x104925598 ld::tool::LocalRelocationsAtom<arm64_32>::~LocalRelocationsAtom() + 0
3 0x104924ab8 ld::tool::SymbolTableAtom<arm64>::addImport(ld::Atom const*, ld::tool::StringPoolAtom*) + 204
4 0x104924150 ld::tool::SymbolTableAtom<arm64>::encode() + 420
5 0x104910c18 ___ZN2ld4tool10OutputFile20buildLINKEDITContentERNS_8InternalE_block_invoke_3 + 36
6 0x1ac8465f0 _dispatch_call_block_and_release + 32
7 0x1ac8481b4 _dispatch_client_callout + 20
8 0x1ac859b14 _dispatch_root_queue_drain + 952
9 0x1ac85a104 _dispatch_worker_thread2 + 164
10 0x1aca08324 _pthread_wqthread + 228
A linker snapshot was created at:
/tmp/project_name-2022-09-18-183942.ld-snapshot
ld: Assertion failed: (dylib != NULL), function classicOrdinalForProxy, file LinkEditClassic.hpp, line 495.
Removing -mcmodel=large solves the issue, but I need this flag for my code.
Does -fno-objc-msgsend-selector-stubs help?
I am learning SwiftUI on 100 Days of SwiftUI on Hacking with Swift. My Xcode SwiftUI Preview crashes and I don't know why. Running on Simulator works though. I tried to completely reinstall Xcode (deleting the app, preferences, libraries etc), but it still doesn't work. I am using Xcode 13.2.1 on iMac 2019 i9 9900K 64GB RAM.
Here is the problem details. (cannot contain full report because of 30000 word limit)
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: SIGNAL 4 Illegal instruction: 4
Terminating Process: exc handler [4180]
Triggered by Thread: 0
Application Specific Information:
CoreSimulator 783.5 - Device: iPod touch (7th generation) (B14B5709-F815-4854-ADB6-E7102668056B) - Runtime: iOS 15.2 (19C51) - DeviceType: iPod touch (7th generation)
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/minsoochoo/Library/Developer/Xcode/DerivedData/WeSplit-ctmzuorhwkvroxgikiijvbbbfwyq/Build/Intermediates.noindex/Previews/WeSplit/Products/Debug-iphonesimulator DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot//System/Library/PrivateFrameworks/PreviewsInjection.framework/PreviewsInjection DYLD_FRAMEWORK_PATH=/Users/minsoochoo/Library/Developer/Xcode/DerivedData/WeSplit-ctmzuorhwkvroxgikiijvbbbfwyq/Build/Intermediates.noindex/Previews/WeSplit/Products/Debug-iphonesimulator
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/minsoochoo/Library/Developer/Xcode/DerivedData/WeSplit-ctmzuorhwkvroxgikiijvbbbfwyq/Build/Intermediates.noindex/Previews/WeSplit/Products/Debug-iphonesimulator DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot//System/Library/PrivateFrameworks/PreviewsInjection.framework/PreviewsInjection DYLD_FRAMEWORK_PATH=/Users/minsoochoo/Library/Developer/Xcode/DerivedData/WeSplit-ctmzuorhwkvroxgikiijvbbbfwyq/Build/Intermediates.noindex/Previews/WeSplit/Products/Debug-iphonesimulator
Thread 0 Crashed:: Dispatch queue: BSXPCCnx:com.apple.dt.xcode-previews.systemservices (BSCnx:client:com.apple.dt.uv.agent-preview-nonui-service)
0 SwiftUI 0x7fff5c970f89 static FocusState._makeProperty<A>(in:container:fieldOffset:inputs:) + 160
1 SwiftUI 0x7fff5c97141e protocol witness for static DynamicProperty._makeProperty<A>(in:container:fieldOffset:inputs:) in conformance FocusState<A> + 25
2 SwiftUI 0x7fff5d17717c _DynamicPropertyBuffer.addFields<A>(_:container:inputs:baseOffset:) + 131
3 SwiftUI 0x7fff5d17709a _DynamicPropertyBuffer.init<A>(fields:container:inputs:baseOffset:) + 111
4 SwiftUI 0x7fff5ce5d24c project #1 <A><A1>(flags:) in closure #1 in BodyAccessor.makeBody(container:inputs:fields:) + 413
5 SwiftUI 0x7fff5ce5d0a4 closure #1 in BodyAccessor.makeBody(container:inputs:fields:) + 113
6 SwiftUI 0x7fff5ce5ebf1 partial apply for closure #1 in BodyAccessor.makeBody(container:inputs:fields:) + 54
7 SwiftUI 0x7fff5ce5ec12 partial apply for thunk for #callee_guaranteed (#unowned UnsafeMutablePointer<_GraphInputs>) -> (#out _GraphValue<A.BodyAccessor.Body>, #out _DynamicPropertyBuffer?, #error #owned Error) + 27
8 libswiftCore.dylib 0x7fff3083190c withUnsafePointer<A, B>(to:_:) + 12
9 libswiftCore.dylib 0x7fff309f2259 withUnsafeMutablePointer<A, B>(to:_:) + 9
10 SwiftUI 0x7fff5ce5c68a BodyAccessor.makeBody(container:inputs:fields:) + 286
11 SwiftUI 0x7fff5c94b39e static View.makeBody(view:inputs:fields:) + 160
12 SwiftUI 0x7fff5c94b0f6 static View.makeViewList(view:inputs:) + 342
13 SwiftUI 0x7fff5c94a5f4 static View._makeViewList(view:inputs:) + 104
14 WeSplit 0x102730029 protocol witness for static View._makeViewList(view:inputs:) in conformance ContentView + 9
15 SwiftUI 0x7fff5ce641cb AnyViewStorage.makeViewList(view:inputs:) + 550
16 SwiftUI 0x7fff5ce6526a closure #2 in AnyViewList.updateValue() + 587
17 SwiftUI 0x7fff5ce64e76 AnyViewList.updateValue() + 976
18 SwiftUI 0x7fff5c83af29 partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 15
19 AttributeGraph 0x7fff4ff9b37b AG::Graph::UpdateStack::update() + 553
20 AttributeGraph 0x7fff4ff9b971 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 411
21 AttributeGraph 0x7fff4ffa1656 AG::Graph::value_ref(AG::AttributeID, AGSwiftMetadata const*, unsigned char&) + 128
22 AttributeGraph 0x7fff4ffb877a AGGraphGetValue + 291
23 SwiftUI 0x7fff5c8b67bd TestableViewContent.list.getter + 47
24 SwiftUI 0x7fff5c8b64a6 TestableViewContent.children.getter + 41
25 SwiftUI 0x7fff5c8b61f2 View.withChildrenForTest<A>(environment:options:body:) + 181
26 SwiftUI 0x7fff5cc7de3f View._allPreviews.getter + 88
27 SwiftUI 0x7fff5cc7ddbe MakePreviews.visit<A>(type:) + 128
28 SwiftUI 0x7fff5d1a5afc _callVisitViewType2 + 34
29 SwiftUI 0x7fff5cc7dd18 static _PreviewProvider._allPreviews.getter + 165
30 PreviewsInjection 0x102ae7f6f 0x102ac4000 + 147311
31 PreviewsInjection 0x102ae7ea3 0x102ac4000 + 147107
32 PreviewsInjection 0x102ae04b6 0x102ac4000 + 115894
33 PreviewsInjection 0x102adc85d 0x102ac4000 + 100445
34 PreviewsInjection 0x102adc265 0x102ac4000 + 98917
35 PreviewsInjection 0x102adc519 0x102ac4000 + 99609
36 BoardServices 0x7fff261a2c1c +[BSXPCServiceConnectionProxy invokeMethod:onTarget:withMessage:forConnection:] + 1596
37 BoardServices 0x7fff261b0884 __63-[BSXPCServiceConnectionEventHandler connection:handleMessage:]_block_invoke + 562
38 BoardServices 0x7fff261d9879 BSXPCServiceConnectionExecuteCallOut + 325
39 BoardServices 0x7fff261b04cf -[BSXPCServiceConnectionEventHandler connection:handleMessage:] + 172
40 BoardServices 0x7fff261d8bd7 -[BSXPCServiceConnection _connection_handleMessage:fromPeer:withHandoff:] + 679
41 libdispatch.dylib 0x7fff2011265a _dispatch_call_block_and_release + 12
42 libdispatch.dylib 0x7fff2011383a _dispatch_client_callout + 8
43 libdispatch.dylib 0x7fff20119e0c _dispatch_lane_serial_drain + 743
44 libdispatch.dylib 0x7fff2011aa07 _dispatch_lane_invoke + 455
45 libdispatch.dylib 0x7fff20120ba5 _dispatch_main_queue_callback_4CF + 848
46 CoreFoundation 0x7fff2036c84d __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
47 CoreFoundation 0x7fff203670aa __CFRunLoopRun + 2772
48 CoreFoundation 0x7fff203660f3 CFRunLoopRunSpecific + 567
49 GraphicsServices 0x7fff2c995cd3 GSEventRunModal + 139
50 UIKitCore 0x7fff25059f42 -[UIApplication _run] + 928
51 UIKitCore 0x7fff2505eb5e UIApplicationMain + 101
52 SwiftUI 0x7fff5d0d5dcf closure #1 in KitRendererCommon(_:) + 196
53 SwiftUI 0x7fff5d0d5d09 runApp<A>(_:) + 148
54 SwiftUI 0x7fff5cabdbad static App.main() + 61
55 WeSplit 0x102732a08 static WeSplitApp.$main() + 72 (WeSplitApp.swift:10)
56 WeSplit 0x102732ab3 main + 67
57 dyld_sim 0x102969ee9 start_sim + 10
58 dyld 0x108ced4fe start + 462
Thread 1:
0 libsystem_pthread.dylib 0x7fff6da2dfec start_wqthread + 0
Thread 2:: Dispatch queue: com.apple.root.utility-qos
0 dyld_sim 0x102973a78 bool SwiftHashTable::equal<SwiftTypeProtocolConformanceLocationKey, SwiftTypeProtocolConformanceLocationKey>(SwiftTypeProtocolConformanceLocationKey const&, SwiftTypeProtocolConformanceLocationKey const&, unsigned char const*) const + 4
1 dyld_sim 0x102985e3a unsigned int SwiftHashTable::getIndex<SwiftTypeProtocolConformanceLocationKey, SwiftTypeProtocolConformanceLocationKey>(SwiftTypeProtocolConformanceLocationKey const&, unsigned char const*) const + 126
2 dyld_sim 0x102985d86 unsigned int SwiftHashTable::getPotentialTarget<SwiftTypeProtocolConformanceLocationKey, SwiftTypeProtocolConformanceLocationKey>(SwiftTypeProtocolConformanceLocationKey const&, unsigned char const*) const + 14
3 dyld_sim 0x102984ebe dyld4::APIs::_dyld_find_protocol_conformance(void const*, void const*, void const*) const + 168
4 libswiftCore.dylib 0x7fff30a40b9f swift_conformsToProtocolMaybeInstantiateSuperclasses(swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolDescriptor<swift::InProcess> const*, bool) + 191
5 libswiftCore.dylib 0x7fff30a408ce swift_conformsToProtocol + 78
6 libswiftCore.dylib 0x7fff30a00cea swift::_conformsToProtocol(swift::OpaqueValue const*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolDescriptorRef<swift::InProcess>, swift::TargetWitnessTable<swift::InProcess> const**) + 42
7 libswiftCore.dylib 0x7fff30a3ff3f swift::_checkGenericRequirements(__swift::__runtime::llvm::ArrayRef<swift::TargetGenericRequirementDescriptor<swift::InProcess> >, __swift::__runtime::llvm::SmallVectorImpl<void const*>&, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>) + 1839
8 libswiftCore.dylib 0x7fff30a3f742 swift::TargetProtocolConformanceDescriptor<swift::InProcess>::getWitnessTable(swift::TargetMetadata<swift::InProcess> const*) const + 290
9 libswiftCore.dylib 0x7fff30a41391 swift_conformsToProtocolMaybeInstantiateSuperclasses(swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolDescriptor<swift::InProcess> const*, bool) + 2225
10 libswiftCore.dylib 0x7fff30a408ce swift_conformsToProtocol + 78
11 AttributeGraph 0x7fff4ffaa1e8 AG::LayoutDescriptor::Builder::visit_element(AG::swift::metadata const*, AG::swift::metadata::ref_kind, unsigned long) + 102
12 AttributeGraph 0x7fff4ff98ea7 AG::swift::metadata_visitor::visit_field(AG::swift::metadata const*, AG::swift::field_record const&, unsigned long) + 79
13 AttributeGraph 0x7fff4ff986b8 AG::swift::metadata::visit(AG::swift::metadata_visitor&) const + 648
14 AttributeGraph 0x7fff4ffaa2a4 AG::LayoutDescriptor::Builder::visit_element(AG::swift::metadata const*, AG::swift::metadata::ref_kind, unsigned long) + 290
15 AttributeGraph 0x7fff4ff98ea7 AG::swift::metadata_visitor::visit_field(AG::swift::metadata const*, AG::swift::field_record const&, unsigned long) + 79
16 AttributeGraph 0x7fff4ff986b8 AG::swift::metadata::visit(AG::swift::metadata_visitor&) const + 648
17 AttributeGraph 0x7fff4ffab04b AG::LayoutDescriptor::make_layout(AG::swift::metadata const*, AGComparisonMode, AG::LayoutDescriptor::HeapMode) + 474
18 AttributeGraph 0x7fff4ffac36c AG::(anonymous namespace)::LayoutCache::drain_queue(void*) + 142
19 libdispatch.dylib 0x7fff2011383a _dispatch_client_callout + 8
20 libdispatch.dylib 0x7fff20124077 _dispatch_root_queue_drain + 788
21 libdispatch.dylib 0x7fff20124867 _dispatch_worker_thread2 + 155
22 libsystem_pthread.dylib 0x7fff6da2f02e _pthread_wqthread + 256
23 libsystem_pthread.dylib 0x7fff6da2dffb start_wqthread + 15
Thread 3:
0 libsystem_pthread.dylib 0x7fff6da2dfec start_wqthread + 0
Thread 4:
0 libsystem_pthread.dylib 0x7fff6da2dfec start_wqthread + 0
Thread 5:
0 libsystem_pthread.dylib 0x7fff6da2dfec start_wqthread + 0
Thread 6:: com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0x7fff6d9d4aba mach_msg_trap + 10
1 libsystem_kernel.dylib 0x7fff6d9d4e2b mach_msg + 59
2 CoreFoundation 0x7fff2036c440 __CFRunLoopServiceMachPort + 319
3 CoreFoundation 0x7fff20366ae3 __CFRunLoopRun + 1293
4 CoreFoundation 0x7fff203660f3 CFRunLoopRunSpecific + 567
5 Foundation 0x7fff2081c754 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 213
6 Foundation 0x7fff2081c9cb -[NSRunLoop(NSRunLoop) runUntilDate:] + 72
7 UIKitCore 0x7fff2511a2d1 -[UIEventFetcher threadMain] + 491
8 Foundation 0x7fff20845550 __NSThread__start__ + 1025
9 libsystem_pthread.dylib 0x7fff6da324f4 _pthread_start + 125
10 libsystem_pthread.dylib 0x7fff6da2e00f thread_start + 15
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000002 rbx: 0x0000000000000000 rcx: 0x00007fff4ffc4b50 rdx: 0x0001000000000028
rdi: 0x0000000000000000 rsi: 0x00007fff8b43c050 rbp: 0x00007ff7bd7d2fb0 rsp: 0x00007ff7bd7d2f70
r8: 0x00007fff5d231685 r9: 0x00007fff86bdd330 r10: 0x0000000000000004 r11: 0x0000000000000072
r12: 0x0000000000000002 r13: 0x00007ff7bd7d30a0 r14: 0x0000000000000040 r15: 0x00007fff8a918d88
rip: 0x00007fff5c970f89 rfl: 0x0000000000010246 cr2: 0x00007fff5d2316b7
Logical CPU: 0
Error Code: 0x00000000
Trap Number: 6
Binary Images:
0x7fff5c697000 - 0x7fff5d4f2fff com.apple.SwiftUI (3.2.5.0.100) <c680d16f-a317-3c6e-87fa-141c22a715da> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/SwiftUI.framework/SwiftUI
0x7fff30710000 - 0x7fff30acffff libswiftCore.dylib (*) <6013ecdd-c54d-3948-8b7c-e9f5613107f6> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/libswiftCore.dylib
0x102728000 - 0x102733fff me.choo.minsoo.WeSplit (1.0) <d0012a27-d11a-39a0-b4eb-f874af3b5857> /Users/USER/Library/Developer/Xcode/UserData/Previews/Simulator Devices/B14B5709-F815-4854-ADB6-E7102668056B/data/Containers/Bundle/Application/BA738B59-7D89-47AA-8012-6234AA6E65B0/WeSplit.app/WeSplit
0x7fff4ff96000 - 0x7fff4ffcafff com.apple.AttributeGraph (3.2.1) <20c3feeb-4d9b-3501-be47-de9ae60ae297> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AttributeGraph.framework/AttributeGraph
0x102ac4000 - 0x102af5fff com.apple.dt.PreviewsInjection (13.0) <385f7334-89cd-3998-bc1b-54dd898b38ad> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/PreviewsInjection.framework/PreviewsInjection
0x7fff2619e000 - 0x7fff261edfff com.apple.BoardServices (1.0) <d4742ff1-1051-348e-afb4-dcb3bc434c50> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/BoardServices.framework/BoardServices
0x7fff20110000 - 0x7fff20157fff libdispatch.dylib (*) <20999e62-bcc2-377e-8ce7-afda271eb914> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib
0x7fff202ec000 - 0x7fff2068bfff com.apple.CoreFoundation (6.9) <c6308add-135b-3a70-9b81-1ce4d994c215> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x7fff2c992000 - 0x7fff2c99afff com.apple.GraphicsServices (1.0) <adea8ae1-c723-351b-ac2e-22fd2c861c30> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x7fff2438c000 - 0x7fff25934fff com.apple.UIKitCore (1.0) <3ef2c381-8193-3e3c-801f-925bd1050bd7> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
0x102968000 - 0x1029b5fff dyld_sim (*) <3f15c197-2d43-3490-98ff-de85f18dadf2> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/dyld_sim
0x108ce8000 - 0x108d53fff dyld (*) <7de33963-bbc5-3996-ba6e-f1d562c17c95> /usr/lib/dyld
0x7fff6da2c000 - 0x7fff6da37fff libsystem_pthread.dylib (*) <ee564342-d8f2-396d-b642-40092cf34d82> /usr/lib/system/libsystem_pthread.dylib
0x7fff6d9d4000 - 0x7fff6da0afff libsystem_kernel.dylib (*) <c1d58a50-5a4d-3bcb-a1fc-ec0902ce34d3> /usr/lib/system/libsystem_kernel.dylib
0x7fff206fa000 - 0x7fff209b0fff com.apple.Foundation (6.9) <61dcc68e-1236-3624-bb6d-a3a850adf63a> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation
EOF
And the diagnostics:
MessageSendFailure: Message send failure for update
==================================
| MessageError: Connection interrupted
Code:
ContentView.swift
import SwiftUI
struct ContentView: View {
#State private var checkAmount = 0.0
#State private var numberOfPeople = 2
#State private var tipPercentage = 20
let tipPercentages = 0..<101
var totalPerPerson: Double {
let peopleCount = Double(numberOfPeople + 2)
let tipSelection = Double(tipPercentage)
let tipValue = checkAmount / 100 * tipSelection
let grandTotal = checkAmount + tipValue
let amountPerPerson = grandTotal / peopleCount
return amountPerPerson
}
var total: Double {
checkAmount + checkAmount / 100 * Double(tipPercentage)
}
#FocusState private var amountIsFocused: Bool
var body: some View {
NavigationView {
Form {
Section {
TextField("Amount", value: $checkAmount, format: .currency(code: Locale.current.currencyCode ?? "USD"))
.keyboardType(.decimalPad)
.focused($amountIsFocused)
Picker("Number of People", selection: $numberOfPeople) {
ForEach(2..<100) {
Text("\($0) people")
}
}
}
Section {
Picker("Tip Percentage", selection: $tipPercentage) {
ForEach(tipPercentages, id: \.self) {
Text($0, format: .percent)
}
}
} header: {
Text("How much tip do you want to leave?")
}
Section {
Text(totalPerPerson, format: .currency(code: Locale.current.currencyCode ?? "USD"))
} header: {
Text("Amount per person")
}
Section {
Text(total, format: .currency(code: Locale.current.currencyCode ?? "USD"))
}
}
.navigationTitle("WeSplit")
}
.toolbar {
ToolbarItemGroup(placement: .keyboard) {
Spacer()
Button("Done") {
amountIsFocused = false
}
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
WeSplitApp.swift
import SwiftUI
#main
struct WeSplitApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Solved by adding ZStack in Preview struct solved it.. This is maybe a bug.
Solution
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ZStack {
ContentView()
}
}
}
Help! I'm updating an old Xcode project from 2016 and I'm encountering crashes when working with my Realm objects.
I have a game I built in Xcode with swift 3 and put in the AppStore in 2016. It used Realm for my Game objects. It was one of my first projects so recently I decided to revisit the project and update the code, clean it up (I was very new to Swift), make it work with newer devices and screens, fix a couple bugs, add a few features, etc. When going through the updates to the current languages, I can no longer save my Game object because in 2016, the Realm properties were written as:
dynamic var numCorrect: Int = 0
dynamic var numWrong: Int = 0
dynamic var score: Int = 0
dynamic var stars: Int = 0
dynamic var date = NSDate()
...
Now Realm requires "#objc" before "dynamic var". So it's now:
#objc dynamic var numCorrect: Int = 0
#objc dynamic var numWrong: Int = 0
#objc dynamic var score: Int = 0
#objc dynamic var stars: Int = 0
#objc dynamic var date = NSDate()
With this change/addition everything works great. UNTIL I try to update on top of the old/current version in the App Store. It crashes when trying to create a new Game object.
I assume there's some way to migrate but I can't figure it out. The migration guide doesn't address upgrading from an old version of Realm to a new version.
Here's the log:
/Users/realm/workspace/realm_realm-core_release_6.0.6/src/realm/group.hpp:1149: [realm-core-6.0.6] Assertion failed: m_top.size() > s_hist_version_ndx
0 Realm 0x0000000103b5db04 _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1 Realm 0x0000000103b5dda0 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 324
2 Realm 0x0000000103a97720 _ZN5realm2DB19upgrade_file_formatEbiii + 980
3 Realm 0x0000000103a95130 _ZN5realm2DB7do_openERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbbNS_9DBOptionsE + 3092
4 Realm 0x0000000103a97b20 _ZN5realm2DB4openERNS_11ReplicationENS_9DBOptionsE + 244
5 Realm 0x0000000103a9c0a4 _ZN5realm2DB6createERNS_11ReplicationENS_9DBOptionsE + 392
6 Realm 0x0000000103644a44 _ZN5realm5_impl16RealmCoordinator7open_dbEv + 972
7 Realm 0x0000000103643c98 _ZN5realm5_impl16RealmCoordinator12do_get_realmENS_5Realm6ConfigERNSt3__110shared_ptrIS2_EENS_4util8OptionalINS_9VersionIDEEERNS8_17CheckedUniqueLockE + 72
8 Realm 0x0000000103643b30 _ZN5realm5_impl16RealmCoordinator9get_realmENS_5Realm6ConfigENS_4util8OptionalINS_9VersionIDEEE + 268
9 Realm 0x0000000103895ae0 _ZN5realm5Realm16get_shared_realmENS0_6ConfigE + 152
10 Realm 0x00000001037e0434 +[RLMRealm realmWithConfiguration:queue:error:] + 1704
11 RealmSwift 0x0000000104be1660 $sSo8RLMRealmC13configuration5queueABSo0A13ConfigurationC_So012OS_dispatch_C0CSgtKcfCTO + 156
12 RealmSwift 0x0000000104c18aa8 $s10RealmSwift0A0V5queueACSo012OS_dispatch_C0CSg_tKcfC + 140
13 Scrath 0x00000001028afa4c $s6Scrath11AppDelegateC11updateRealmyyF + 680
14 Scrath 0x00000001028af438 $s6Scrath11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtF + 288
15 Scrath 0x00000001028af534 $s6Scrath11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtFTo + 232
16 UIKitCore 0x00000001c31e478c 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 10893196
17 UIKitCore 0x00000001c31e656c 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 10900844
18 UIKitCore 0x00000001c31ebf68 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 10923880
19 UIKitCore 0x00000001c295eb50 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 1956688
20 UIKitCore 0x00000001c2e29510 _UIScenePerformActionsWithLifecycleActionMask + 112
21 UIKitCore 0x00000001c295f684 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 1959556
22 UIKitCore 0x00000001c295f0b0 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 1958064
23 UIKitCore 0x00000001c295f4a0 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 1959072
24 UIKitCore 0x00000001c295ed28 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 1957160
25 UIKitCore 0x00000001c2963444 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 1975364
26 UIKitCore 0x00000001c2d48080 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 6058112
27 UIKitCore 0x00000001c2e431b4 _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 260
28 UIKitCore 0x00000001c2963180 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 1974656
29 UIKitCore 0x00000001c2e4309c _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 108
30 UIKitCore 0x00000001c2962fd8 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 1974232
31 UIKitCore 0x00000001c27c8db8 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 294328
32 UIKitCore 0x00000001c27c78b8 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 288952
33 UIKitCore 0x00000001c27c8ae8 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 293608
34 UIKitCore 0x00000001c31ea200 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 10916352
35 UIKitCore 0x00000001c2d6ea50 66C0BDEB-71CF-3148-AF27-A5B055FAD9A5 + 6216272
36 FrontBoardServices 0x00000001c4304bec 039FCB83-A7EC-3872-94E8-DD490434EAEB + 52204
37 FrontBoardServices 0x00000001c432b190 039FCB83-A7EC-3872-94E8-DD490434EAEB + 209296
38 FrontBoardServices 0x00000001c430faac 039FCB83-A7EC-3872-94E8-DD490434EAEB + 96940
39 FrontBoardServices 0x00000001c432ae24 039FCB83-A7EC-3872-94E8-DD490434EAEB + 208420
40 libdispatch.dylib 0x0000000104da318c _dispatch_client_callout + 20
41 libdispatch.dylib 0x0000000104da6964 _dispatch_block_invoke_direct + 368
42 FrontBoardServices 0x00000001c43512b4 039FCB83-A7EC-3872-94E8-DD490434EAEB + 365236
43 FrontBoardServices 0x00000001c4350f60 039FCB83-A7EC-3872-94E8-DD490434EAEB + 364384
44 FrontBoardServices 0x00000001c43514cc 039FCB83-A7EC-3872-94E8-DD490434EAEB + 365772
45 CoreFoundation 0x00000001bf01f860 9624AAFD-5437-3772-A507-0F357875808D + 710752
46 CoreFoundation 0x00000001bf01f7b4 9624AAFD-5437-3772-A507-0F357875808D + 710580
47 CoreFoundation 0x00000001bf01ef04 9624AAFD-5437-3772-A507-0F357875808D + 708356
48 CoreFoundation 0x00000001bf019ca4 9624AAFD-5437-3772-A507-0F357875808D + 687268
49 CoreFoundation 0x00000001bf019660 CFRunLoopRunSpecific + 480
50 GraphicsServices 0x00000001c942a604 GSEventRunModal + 164
51 UIKitCore 0x00000001c31ee15c UIApplicationMain + 1944
52 Scrath 0x00000001028b16a4 main + 80
53 libdyld.dylib 0x00000001bee951ec 95B366E7-F5BD-3308-9416-24B35999029B + 4588!!! IMPORTANT: Please send this log and info about Realm SDK version and other relevant reproduction info to help#realm.io
Please, does anyone know how to solve this? It's not like this app is popular but I don't want to require any previous user to delete the app in order to use the new version.
I would try to implement a migration block and use enumerate as follows:
migration.enumerateObjects(ofType: Object.className()) { (oldObject, newObject) in
guard let numCorrect = oldObject?["numCorrect"] as? Int else {
fatalError("numCorrect is not a Int")
}
// List all the rest of your properties the same way (i.e., with a guard statement)
// Then assign old object value to new property
newObject?["numCorrect"] = numCorrect
}
Make sure you implement your migration block properly with the right version etc..
For anyone having this problem, it appears to be a bug with Realm's current version. In my podfile I wrote:
pod 'RealmSwift', '<5.0'
pod 'Realm', '<5.0'
And now my project runs perfectly. Thanks #RobertCrabtree!
Since I added translations between two ContentViews (to go from one to the other one nicely), I have the following logs:
This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes.
Stack:(
0 Foundation 0x0000000110da2ec6 _AssertAutolayoutOnAllowedThreadsOnly + 77
1 Foundation 0x0000000110da2b89 -[NSISEngine _optimizeWithoutRebuilding] + 61
2 Foundation 0x0000000110bb1ebb -[NSISEngine optimize] + 108
3 Foundation 0x0000000110da00ac -[NSISEngine performPendingChangeNotifications] + 84
4 UIKit 0x00000001116f89f9 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2211
5 QuartzCore 0x00000001138a63ee -[CALayer layoutSublayers] + 153
6 QuartzCore 0x00000001138aa4dd _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 401
7 QuartzCore 0x0000000113832ded _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 365
8 QuartzCore 0x000000011385e704 _ZN2CA11Transaction6commitEv + 500
9 MyProject.iOS 0x000000010f6bbd39 xamarin_dyn_objc_msgSend + 217
10 ??? 0x000000012f8e9462 0x0 + 5092840546
11 ??? 0x000000013025827c 0x0 + 5102731900
12 MyProject.iOS 0x000000010f5272c9 mono_jit_runtime_invoke + 1273
13 MyProject.iOS 0x000000010f5dbaa8 do_runtime_invoke + 88
14 MyProject.iOS 0x000000010f61bf9e start_wrapper + 718
15 libsystem_pthread.dylib 0x0000000117fe06c1 _pthread_body + 340
16 libsystem_pthread.dylib 0x0000000117fe056d _pthread_body + 0
17 libsystem_pthread.dylib 0x0000000117fdfc5d thread_start + 13
)
This is my code:
Device.BeginInvokeOnMainThread(async () =>
{
DetailContentView.Children.Insert(0, masterDetailContentView);
await DetailContentView.Children[1].TranslateTo(App.ScreenWidth - 100, 0, 250);
await DetailContentView.Children[1].TranslateTo(App.ScreenWidth, 0, 50);
DetailContentView.Children.RemoveAt(1);
});
where DetailContentView is a Grid, masterDetailContentView is the ContentView that will appear and DetailContentView.Children[1] is the ContentView that will disappear.
This piece of code works but I want to remove the logs.
Thanks!
I'm at my wit's end trying to figure out a "silent" crash I am getting. There isn't a specific part of code where it occurs, because I have placed nslogs in several locations and there is no correlation with them and the crash.
I am using vmtracker in the instruments allocation tool and my dirty memory varies but crashes as low as 32 MB. My live bytes in allocations (not vmtracker) is stable at around 10-12 MB.
I could understand it if it was some logic error, but this is a silent crash and xcode gives no information except NSZombie_NSException.
This is from the crash log:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x60000008
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x34da9564 0x34da6000 + 13668
1 libobjc.A.dylib 0x34da9f84 0x34da6000 + 16260
2 libobjc.A.dylib 0x34dab1d2 0x34da6000 + 20946
3 CoreFoundation 0x372ae600 0x371ec000 + 796160
4 CoreFoundation 0x372ae358 0x371ec000 + 795480
5 libobjc.A.dylib 0x34daea62 0x34da6000 + 35426
6 libc++abi.dylib 0x35a41078 0x35a40000 + 4216
7 libc++abi.dylib 0x35a41110 0x35a40000 + 4368
8 libc++abi.dylib 0x35a42594 0x35a40000 + 9620
9 libobjc.A.dylib 0x34dae9cc 0x34da6000 + 35276
10 CoreFoundation 0x371f4f1c 0x371ec000 + 36636
11 CoreFoundation 0x371f4d44 0x371ec000 + 36164
12 GraphicsServices 0x34eaa2e6 0x34ea5000 + 21222
13 UIKit 0x36c6c2fc 0x36c15000 + 357116
14 Pocket Dungeons 0x0008a2be 0x3a000 + 328382
15 Pocket Dungeons 0x0003b8bc 0x3a000 + 6332
Is 32 MB a lot of dirty memory for iPod Touch 4g, iOS 6?