I'm facing a really strange behavior in an iPad App. I create several bundles, the app downloads them an saves them to the documents directory.
I have a custom bundle manager where i can load the bundles like this.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *bundlePath;
if (![bundleName hasSuffix:#".bundle"]) {
bundlePath = [documentsDirectory stringByAppendingFormat:#"/%#.bundle", bundleName];
} else {
bundlePath = [documentsDirectory stringByAppendingFormat:#"/%#", bundleName];
}
NSBundle *bundle = nil;
NSError *error = nil;
bundle = [[NSBundle alloc] initWithPath:bundlePath];
if (!bundle) {
return nil;
}
[bundle loadAndReturnError:&error];
In debug mode all code works like a charm. The bundle gets loaded and the content can be used in the app. The bundles contain images and nibs, no code. In the bundle build settings I've set COMBINE_HIDPI_IMAGES to NO, so that the images will not be combined as tiff images. The bundles also do not contain any code.
So what's the problem. Well when starting the app without debugging (not connected to Xcode) the app crashes and generates this error message. [bundle loadAndReturnError:&error] is where the code crashes.
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 dyld 0x2fe8e2d8 strcmp + 0
1 dyld 0x2fe83aac ImageLoaderMachO::parseLoadCmds() + 56
2 dyld 0x2fe88d30 ImageLoaderMachOCompressed::instantiateFromFile(char const*, int, unsigned char const*, unsigned long long, unsigned long long, stat const&, unsigned int, unsigned int, linkedit_data_command const*, ImageLoader::LinkContext const&) + 296
3 dyld 0x2fe839c6 ImageLoaderMachO::instantiateFromFile(char const*, int, unsigned char const*, unsigned long long, unsigned long long, stat const&, ImageLoader::LinkContext const&) + 222
4 dyld 0x2fe7b0d4 dyld::loadPhase6(int, stat const&, char const*, dyld::LoadContext const&) + 664
5 dyld 0x2fe7e774 dyld::loadPhase5stat(char const*, dyld::LoadContext const&, stat*, int*, bool*, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 428
6 dyld 0x2fe7e498 dyld::loadPhase5(char const*, char const*, dyld::LoadContext const&, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 248
7 dyld 0x2fe7e37c dyld::loadPhase4(char const*, char const*, dyld::LoadContext const&, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 128
8 dyld 0x2fe7e29c dyld::loadPhase3(char const*, char const*, dyld::LoadContext const&, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 984
9 dyld 0x2fe7dc36 dyld::loadPhase1(char const*, char const*, dyld::LoadContext const&, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 110
10 dyld 0x2fe7ada4 dyld::loadPhase0(char const*, char const*, dyld::LoadContext const&, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 168
11 dyld 0x2fe7ab58 dyld::load(char const*, dyld::LoadContext const&) + 208
12 dyld 0x2fe7f8da dlopen + 802
13 libdyld.dylib 0x39dee946 dlopen + 46
14 CoreFoundation 0x31ab4910 _CFBundleDlfcnLoadBundle + 128
15 CoreFoundation 0x31ab478c _CFBundleLoadExecutableAndReturnError + 356
16 Foundation 0x323d2154 -[NSBundle loadAndReturnError:] + 844
17 Visitor Self Service 0x000e251a -[CoreBundleManager bundleForName:] (CoreBundleManager.m:70)
18 Visitor Self Service 0x000cd418 -[CoreProcessDefinition processBundle] (CoreProcessDefinition.m:226)
19 Visitor Self Service 0x000cf17e -[CoreProcessRuntime loadControllerForStep:] (CoreProcessRuntime.m:187)
20 Visitor Self Service 0x000ce9f4 -[CoreProcessRuntime performNextStepInProcessDefinition] (CoreProcessRuntime.m:112)
21 Visitor Self Service 0x000ba642 __62-[DynamicViewController prepareControllerForProcessDefinition]_block_invoke (DynamicViewController.m:107)
22 libdispatch.dylib 0x39ddb790 _dispatch_call_block_and_release + 8
23 libdispatch.dylib 0x39dde8be _dispatch_after_timer_callback + 10
24 libdispatch.dylib 0x39ddb5d8 _dispatch_client_callout + 20
25 libdispatch.dylib 0x39ddc48a _dispatch_source_invoke + 254
26 libdispatch.dylib 0x39ddee04 _dispatch_main_queue_callback_4CF + 164
27 CoreFoundation 0x31afb1ac __CFRunLoopRun + 1284
28 CoreFoundation 0x31a6e238 CFRunLoopRunSpecific + 352
29 CoreFoundation 0x31a6e0c4 CFRunLoopRunInMode + 100
30 GraphicsServices 0x35629336 GSEventRunModal + 70
31 UIKit 0x3398a2b4 UIApplicationMain + 1116
32 Visitor Self Service 0x000b66d8 main (main.m:16)
33 libdyld.dylib 0x39deeb1c start + 0
Finally I got it working.
There are several steps for setting up a proper bundle.
In the Project Build Settings for the Bundle set
Architectures => armv7, armv7s
Supported Plattforms => iOS
Valid Architectures => armv7, armv7s
Set up a valid Code Sign Identity
Set up a matching provisioning profile
You also need a Info.plist
Required Device Capabilities => armv7, armv7s
Principal Class => Your bundles principal class name
Executable File => Same as Principal Class
Note
External code execution is prohibited by the Apple Review Guidelines, so it's only possible in In-House Apps.
2.7 Apps that download code in any way or form will be rejected
2.8 Apps that install or launch other executable code will be rejected
Related
My app in TestFlight has a few times crashed on launch, and when it decides to crash it will do so on every launch afterwards. Only way to fix it, is to reinstall the app, and then in a future time it will crash again, so I have no idea how to reproduce the crash.
I have the crash log, but I am unsure what to read from it. The app is pure SwiftUI.
Incident Identifier: 643EF787-991A-41DD-98C9-CFFCEA4C8982
CrashReporter Key: 8eb3731ae5012452a0a5758baaacba1a94696953
Hardware Model: iPhone12,3
Process: TimeMindster [5006]
Path: /private/var/containers/Bundle/Application/99C55F69-E5DA-47CF-BC59-CBC20965489F/TimeMindster.app/TimeMindster
Identifier: com.magnuskahr.TimeMindster
Version: 12 (1.0)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.magnuskahr.TimeMindster [1341]
Date/Time: 2021-04-28 21:14:04.6293 +0200
Launch Time: 2021-04-28 21:14:04.0304 +0200
OS Version: iPhone OS 14.5 (18E199)
Release Type: User
Baseband Version: 2.04.07
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Application Specific Information:
abort() called
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001b3a3f334 __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001d1461aa0 pthread_kill + 272
2 libsystem_c.dylib 0x000000018edc6b90 abort + 104
3 AttributeGraph 0x00000001aee71a6c util::Heap::Heap+ 121452 (void*, unsigned long, unsigned long) + 0
4 AttributeGraph 0x00000001aee5f4cc AG::Graph::any_inputs_changed+ 46284 (AG::data::ptr<AG::Node>, unsigned int const*, unsigned long) + 0
5 AttributeGraph 0x00000001aee7109c AGGraphGetValue + 232
6 SwiftUI 0x000000018c450344 MergePreferenceKeys.rhs.getter + 32
7 SwiftUI 0x000000018c450394 MergePreferenceKeys.value.getter + 52
8 SwiftUI 0x000000018c0ecf64 specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 1949540 (_:) + 36
9 SwiftUI 0x000000018c148490 partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 2323600 (_:) + 48
10 AttributeGraph 0x00000001aee5977c AG::Graph::UpdateStack::update+ 22396 () + 492
11 AttributeGraph 0x00000001aee59bb4 AG::Graph::update_attribute+ 23476 (AG::data::ptr<AG::Node>, bool) + 332
12 AttributeGraph 0x00000001aee5f2fc AG::Graph::input_value_ref_slow+ 45820 (AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 364
13 AttributeGraph 0x00000001aee7109c AGGraphGetValue + 232
14 SwiftUI 0x000000018c0bbd00 specialized HostPreferencesWriter.updateValue+ 1748224 () + 136
15 SwiftUI 0x000000018c10c5ac partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 2078124 (_:) + 24
16 AttributeGraph 0x00000001aee5977c AG::Graph::UpdateStack::update+ 22396 () + 492
17 AttributeGraph 0x00000001aee59bb4 AG::Graph::update_attribute+ 23476 (AG::data::ptr<AG::Node>, bool) + 332
18 AttributeGraph 0x00000001aee5f2fc AG::Graph::input_value_ref_slow+ 45820 (AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 364
19 AttributeGraph 0x00000001aee7109c AGGraphGetValue + 232
20 SwiftUI 0x000000018c0bbcd8 specialized HostPreferencesWriter.updateValue+ 1748184 () + 96
21 SwiftUI 0x000000018c10c5ac partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 2078124 (_:) + 24
22 AttributeGraph 0x00000001aee5977c AG::Graph::UpdateStack::update+ 22396 () + 492
23 AttributeGraph 0x00000001aee59bb4 AG::Graph::update_attribute+ 23476 (AG::data::ptr<AG::Node>, bool) + 332
24 AttributeGraph 0x00000001aee5f2fc AG::Graph::input_value_ref_slow+ 45820 (AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 364
25 AttributeGraph 0x00000001aee7109c AGGraphGetValue + 232
26 SwiftUI 0x000000018c0bbcd8 specialized HostPreferencesWriter.updateValue+ 1748184 () + 96
27 SwiftUI 0x000000018c10c5ac partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 2078124 (_:) + 24
28 AttributeGraph 0x00000001aee5977c AG::Graph::UpdateStack::update+ 22396 () + 492
29 AttributeGraph 0x00000001aee59bb4 AG::Graph::update_attribute+ 23476 (AG::data::ptr<AG::Node>, bool) + 332
30 AttributeGraph 0x00000001aee5f2fc AG::Graph::input_value_ref_slow+ 45820 (AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 364
31 AttributeGraph 0x00000001aee7109c AGGraphGetValue + 232
32 SwiftUI 0x000000018c2b8ecc DynamicPreferenceCombiner.value.getter + 1028
33 SwiftUI 0x000000018c1a3144 implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>+ 2695492 (_:) + 252
34 AttributeGraph 0x00000001aee5977c AG::Graph::UpdateStack::update+ 22396 () + 492
35 AttributeGraph 0x00000001aee59bb4 AG::Graph::update_attribute+ 23476 (AG::data::ptr<AG::Node>, bool) + 332
36 AttributeGraph 0x00000001aee5ed6c AG::Graph::value_ref+ 44396 (AG::AttributeID, AGSwiftMetadata const*, bool*) + 156
37 AttributeGraph 0x00000001aee710e4 AGGraphGetValue + 304
38 SwiftUI 0x000000018c97649c GraphHost.updatePreferences+ 10900636 () + 56
39 SwiftUI 0x000000018c3fd188 ViewGraph.updateOutputs+ 5161352 (at:) + 112
40 SwiftUI 0x000000018c8c1688 closure #1 in ViewRendererHost.render+ 10159752 (interval:updateDisplayList:) + 1508
41 SwiftUI 0x000000018c8b7bdc ViewRendererHost.render+ 10120156 (interval:updateDisplayList:) + 308
42 SwiftUI 0x000000018c2cc72c closure #1 in _UIHostingView.requestImmediateUpdate+ 3913516 () + 72
43 SwiftUI 0x000000018ca4d89c thunk for #escaping #callee_guaranteed () -> + 11782300 () + 28
44 libdispatch.dylib 0x0000000185631a54 _dispatch_call_block_and_release + 32
45 libdispatch.dylib 0x00000001856337ec _dispatch_client_callout + 20
46 libdispatch.dylib 0x0000000185641c40 _dispatch_main_queue_callback_4CF + 884
47 CoreFoundation 0x00000001859c01f8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
48 CoreFoundation 0x00000001859ba0d0 __CFRunLoopRun + 2524
49 CoreFoundation 0x00000001859b91c0 CFRunLoopRunSpecific + 600
50 GraphicsServices 0x000000019cfa1734 GSEventRunModal + 164
51 UIKitCore 0x00000001884277e4 -[UIApplication _run] + 1072
52 UIKitCore 0x000000018842d054 UIApplicationMain + 168
53 SwiftUI 0x000000018c8fd350 closure #1 in KitRendererCommon+ 10404688 (_:) + 112
54 SwiftUI 0x000000018c8fd2dc runApp<A>+ 10404572 (_:) + 224
55 SwiftUI 0x000000018c3f5b4c static App.main+ 5131084 () + 144
56 TimeMindster 0x000000010230dce0 0x102294000 + 498912
57 TimeMindster 0x000000010230dd80 0x102294000 + 499072
58 libdyld.dylib 0x0000000185675cf8 start + 4
Thread 1:
0 libsystem_pthread.dylib 0x00000001d1469744 start_wqthread + 0
Thread 2:
0 libsystem_pthread.dylib 0x00000001d1469744 start_wqthread + 0
Thread 3 name: Dispatch queue: com.apple.root.utility-qos
Thread 3:
0 libswiftCore.dylib 0x000000018994b154 swift_conformsToProtocolImpl(swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolDescriptor<swift::InProcess> const*)::$_5::operator()((anonymous namespace)::ConformanceSection const&) const::'lambda'(swift::TargetProtocolConformanceDescriptor<swift::InProcess> const&)::operator()+ 3895636 (swift::TargetProtocolConformanceDescriptor<swift::InProcess> const&) const + 40
1 libswiftCore.dylib 0x000000018994a344 swift_conformsToProtocolImpl+ 3892036 (swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolDescriptor<swift::InProcess> const*) + 596
2 libswiftCore.dylib 0x000000018994a344 swift_conformsToProtocolImpl+ 3892036 (swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolDescriptor<swift::InProcess> const*) + 596
3 AttributeGraph 0x00000001aee65d2c AG::LayoutDescriptor::Builder::visit_element+ 73004 (AG::swift::metadata const*, AG::swift::metadata::ref_kind, unsigned long) + 212
4 AttributeGraph 0x00000001aee576d4 AG::swift::metadata_visitor::visit_field+ 14036 (AG::swift::metadata const*, AG::swift::field_record const&, unsigned long) + 96
5 AttributeGraph 0x00000001aee56e64 AG::swift::metadata::visit+ 11876 (AG::swift::metadata_visitor&) const + 820
6 AttributeGraph 0x00000001aee660e8 AG::LayoutDescriptor::Builder::visit_case+ 73960 (AG::swift::metadata const*, AG::swift::field_record const&, unsigned int) + 376
7 AttributeGraph 0x00000001aee56de0 AG::swift::metadata::visit+ 11744 (AG::swift::metadata_visitor&) const + 688
8 AttributeGraph 0x00000001aee65e08 AG::LayoutDescriptor::Builder::visit_element+ 73224 (AG::swift::metadata const*, AG::swift::metadata::ref_kind, unsigned long) + 432
9 AttributeGraph 0x00000001aee576d4 AG::swift::metadata_visitor::visit_field+ 14036 (AG::swift::metadata const*, AG::swift::field_record const&, unsigned long) + 96
10 AttributeGraph 0x00000001aee56e64 AG::swift::metadata::visit+ 11876 (AG::swift::metadata_visitor&) const + 820
11 AttributeGraph 0x00000001aee66bdc AG::LayoutDescriptor::make_layout+ 76764 (AG::swift::metadata const*, AGComparisonMode, AG::LayoutDescriptor::HeapMode) + 624
12 AttributeGraph 0x00000001aee67eb4 AG::(anonymous namespace)::LayoutCache::drain_queue+ 81588 (void*) + 152
13 libdispatch.dylib 0x00000001856337ec _dispatch_client_callout + 20
14 libdispatch.dylib 0x00000001856450dc _dispatch_root_queue_drain + 688
15 libdispatch.dylib 0x00000001856457a8 _dispatch_worker_thread2 + 112
16 libsystem_pthread.dylib 0x00000001d1462768 _pthread_wqthread + 216
17 libsystem_pthread.dylib 0x00000001d146974c start_wqthread + 8
Thread 4:
0 libsystem_pthread.dylib 0x00000001d1469744 start_wqthread + 0
Thread 5:
0 libsystem_pthread.dylib 0x00000001d1469744 start_wqthread + 0
Thread 6 name: com.apple.uikit.eventfetch-thread
Thread 6:
0 libsystem_kernel.dylib 0x00000001b3a1a4fc mach_msg_trap + 8
1 libsystem_kernel.dylib 0x00000001b3a19884 mach_msg + 76
2 CoreFoundation 0x00000001859bfd10 __CFRunLoopServiceMachPort + 372
3 CoreFoundation 0x00000001859b9bb0 __CFRunLoopRun + 1212
4 CoreFoundation 0x00000001859b91c0 CFRunLoopRunSpecific + 600
5 Foundation 0x0000000186c99fac -[NSRunLoop+ 32684 (NSRunLoop) runMode:beforeDate:] + 232
6 Foundation 0x0000000186c99e78 -[NSRunLoop+ 32376 (NSRunLoop) runUntilDate:] + 92
7 UIKitCore 0x00000001884dc38c -[UIEventFetcher threadMain] + 516
8 Foundation 0x0000000186e0b2fc __NSThread__start__ + 864
9 libsystem_pthread.dylib 0x00000001d1460c00 _pthread_start + 320
10 libsystem_pthread.dylib 0x00000001d1469758 thread_start + 8
Thread 7:
0 libsystem_pthread.dylib 0x00000001d1469744 start_wqthread + 0
Thread 8:
0 libsystem_pthread.dylib 0x00000001d1469744 start_wqthread + 0
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000
x4: 0x00000000000062dc x5: 0x000000000000000b x6: 0x000000000000000a x7: 0x000000000000003e
x8: 0x6f2c18735f2b4680 x9: 0x6f2c18725da73e40 x10: 0x00000000000007fd x11: 0x000000000000005e
x12: 0x0000000000000001 x13: 0x00000000d180105d x14: 0x00000000d1a01800 x15: 0x0000000000001800
x16: 0x0000000000000148 x17: 0x00000001028c78c0 x18: 0x000000011111fe1c x19: 0x0000000000000006
x20: 0x0000000000000103 x21: 0x00000001028c79a0 x22: 0x000000000001ca18 x23: 0x0000000000000000
x24: 0x0000000000000000 x25: 0x000000000000f618 x26: 0x00000001e7f20950 x27: 0x0000000102b1d66c
x28: 0x0000000102b0f418 fp: 0x000000016db69400 lr: 0x00000001d1461aa0
sp: 0x000000016db693e0 pc: 0x00000001b3a3f334 cpsr: 0x40000000
esr: 0x56000080 Address size fault
I had experienced same problem. It was caused by combination of AnyView and NSViewRepresentable wrapper for WKWebView. Getting rid of AnyView by rewriting helper function with #ViewBuilder fixed the problem.
Problem:
func viewFunc() -> AnyView {
switch self {
case .case1: return AnyView(ListOfWebViewWrappers())
default: return AnyView(WaitView())
}
}
Solution:
#ViewBuilder
func viewFunc() -> some View {
switch self {
case .case1: ListOfWebViewWrappers()
default: WaitView()
}
}
the #ViewBuilder allows SwiftUI to properly track each view's identity and properly manage resources. More information about view's identity: https://developer.apple.com/videos/play/wwdc2021/10022/
To check the existence of any threading issue I tried using Thread Sanitiser. But upon enabling it in Edit Scheme my app is crashing as soon as I launch the app. Below is the stack backtrace.
* thread #1, stop reason = signal SIGABRT
* frame #0: 0x0000000117791ad6 libsystem_kernel.dylib`__abort_with_payload + 10
frame #1: 0x00000001177933df libsystem_kernel.dylib`abort_with_payload_wrapper_internal + 80
frame #2: 0x000000011779338f libsystem_kernel.dylib`abort_with_reason + 19
frame #3: 0x00000001177d8c29 libsystem_pthread.dylib`pthread_self.cold.1 + 24
frame #4: 0x00000001177d2334 libsystem_pthread.dylib`pthread_self + 35
frame #5: 0x000000010ea1516b libclang_rt.tsan_iossim_dynamic.dylib`__tsan::cur_thread() + 11
frame #6: 0x000000010e9ea985 libclang_rt.tsan_iossim_dynamic.dylib`wrap_sysctlbyname + 37
frame #7: 0x00000001176bd390 libsystem_sim_kernel.dylib`assert_simulator_supported_host + 44
frame #8: 0x0000000116301a0c libSystem.B.dylib`libSystem_initializer + 56
frame #9: 0x000000010e928f14 dyld_sim`ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 518
frame #10: 0x000000010e929112 dyld_sim`ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) + 40
frame #11: 0x000000010e924547 dyld_sim`ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 343
frame #12: 0x000000010e9244d3 dyld_sim`ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 227
frame #13: 0x000000010e9244d3 dyld_sim`ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 227
frame #14: 0x000000010e9244d3 dyld_sim`ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 227
frame #15: 0x000000010e923704 dyld_sim`ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 134
frame #16: 0x000000010e923798 dyld_sim`ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) + 74
frame #17: 0x000000010e917342 dyld_sim`dyld::initializeMainExecutable() + 129
frame #18: 0x000000010e91b497 dyld_sim`dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 4395
frame #19: 0x000000010e916624 dyld_sim`start_sim + 136
frame #20: 0x000000011092879a dyld`dyld::useSimulatorDyld(int, macho_header const*, char const*, int, char const**, char const**, char const**, unsigned long*, unsigned long*) + 2308
frame #21: 0x0000000110926432 dyld`dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 837
frame #22: 0x0000000110921227 dyld`dyldbootstrap::start(dyld3::MachOLoaded const*, int, char const**, dyld3::MachOLoaded const*, unsigned long*) + 453
frame #23: 0x0000000110921025 dyld`_dyld_start + 37
I also tried changing Strip Style from All Symbols to Debugging Symbols but no avail. Any suggestion in this regard will be helpful. Thanks.
Which Xcode version are you using?
Because in Release Notes of Xcode 11.3.1 you can find a fix for the Thread Sanitizer.
Resolved an issue that prevented Xcode from launching processes with Thread Sanitizer enabled on macOS Catalina 10.15.2. (57822138)
I'm having a strange issue with an iOS app of mine. When it is run via Xcode (Build & Run), all works well. The app launches and everything works as expected.
However, if I try to open the app by tapping its icon as the user would (via Springboard), the app crashes immediately with the crashlog below. It seems to point to some kind of an image-releated issue, but I don't understand how it doesn't occur when debugging using Xcode.
Can anyone shed some light?
Date/Time: 2012-06-15 16:13:29.035 +0100
OS Version: iPhone OS 5.1.1 (9B206)
Report Version: 104
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 dyld 0x2fe76464 strcmp + 0
1 dyld 0x2fe6a6e2 ImageLoaderMachO::parseLoadCmds() + 54
2 dyld 0x2fe72058 ImageLoaderMachOCompressed::instantiateFromFile(char const*, int, unsigned char const*, unsigned long long, unsigned long long, stat const&, unsigned int, unsigned int, linkedit_data_command const*, ImageLoader::LinkContext const&) + 296
3 dyld 0x2fe6b23a ImageLoaderMachO::instantiateFromFile(char const*, int, unsigned char const*, unsigned long long, unsigned long long, stat const&, ImageLoader::LinkContext const&) + 302
4 dyld 0x2fe622f6 _ZN4dyldL10loadPhase6EiRK4statPKcRKNS_11LoadContextE + 478
5 dyld 0x2fe6255e _ZN4dyldL14loadPhase5statEPKcRKNS_11LoadContextEP4statPiPbPSt6vectorIS1_SaIS1_EE + 386
6 dyld 0x2fe62716 _ZN4dyldL10loadPhase5EPKcS1_RKNS_11LoadContextEPSt6vectorIS1_SaIS1_EE + 278
7 dyld 0x2fe628fe _ZN4dyldL10loadPhase4EPKcS1_RKNS_11LoadContextEPSt6vectorIS1_SaIS1_EE + 218
8 dyld 0x2fe630dc _ZN4dyldL10loadPhase3EPKcS1_RKNS_11LoadContextEPSt6vectorIS1_SaIS1_EE + 1144
9 dyld 0x2fe63240 _ZN4dyldL10loadPhase1EPKcS1_RKNS_11LoadContextEPSt6vectorIS1_SaIS1_EE + 108
10 dyld 0x2fe63392 _ZN4dyldL10loadPhase0EPKcS1_RKNS_11LoadContextEPSt6vectorIS1_SaIS1_EE + 262
11 dyld 0x2fe634c4 dyld::load(char const*, dyld::LoadContext const&) + 224
12 dyld 0x2fe650f2 dlopen + 742
13 libdyld.dylib 0x360d55a2 dlopen + 42
14 CoreFoundation 0x37256092 _CFBundleDlfcnLoadBundle + 106
15 CoreFoundation 0x37255f36 _CFBundleLoadExecutableAndReturnError + 370
16 Foundation 0x32d7bf40 -[NSBundle loadAndReturnError:] + 904
17 SomeApp 0x000bcb3a 0x5e000 + 387898
18 SomeApp 0x000c56d0 0x5e000 + 423632
19 SomeApp 0x000c539a 0x5e000 + 422810
20 SomeApp 0x00062f86 0x5e000 + 20358
21 UIKit 0x30438c84 -[UIViewController view] + 160
22 SomeApp 0x000622a6 0x5e000 + 17062
23 SomeApp 0x0005fcc4 0x5e000 + 7364
24 UIKit 0x30437ca4 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1176
25 UIKit 0x304317d6 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 402
26 UIKit 0x303ffabc -[UIApplication handleEvent:withNewEvent:] + 1004
27 UIKit 0x303ff560 -[UIApplication sendEvent:] + 48
28 UIKit 0x303fef34 _UIApplicationHandleEvent + 5820
29 GraphicsServices 0x3741b224 PurpleEventCallback + 876
30 CoreFoundation 0x3729f51c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
31 CoreFoundation 0x3729f4be __CFRunLoopDoSource1 + 134
32 CoreFoundation 0x3729e30c __CFRunLoopRun + 1364
33 CoreFoundation 0x3722149e CFRunLoopRunSpecific + 294
34 CoreFoundation 0x37221366 CFRunLoopRunInMode + 98
35 UIKit 0x30430864 -[UIApplication _run] + 544
36 UIKit 0x3042dcce UIApplicationMain + 1074
37 SomeApp 0x0005fb00 0x5e000 + 6912
38 SomeApp 0x0005fac0 0x5e000 + 6848
Edit: Talked this through with the Apple Developer Team. The issue is that I used a self-made plugin in my app that wasn't codesigned (even though I told Xcode to do so). However, Xcode 4.3.3 has a bug that breaks codesigning for bundles, so we'll see how this works out soon.
It looks like this is still a problem as of Xcode 4.5. As a workaround, it seems that you can force the build to sign the bundle.
Adding the following as a final "Run Script" build phase for the bundle fixed it for me:
codesign -fs "iPhone Developer" ${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}
Your application may be taking too long to launch. It is given unlimited time when launching from Xcode, but is not afforded this luxury when launching from SpringBoard.
Take a look at this for reference: https://developer.apple.com/library/ios/#qa/qa2009/qa1592.html
edit: Oh, how did I get here... this is two weeks old.
I'm using Xcode 4.2 final Build 4D199 from the Mac App Store. When I want to start any application in the iOS 5 simulator it quits telling me that i can Quit, Switch SDK or Relaunch. I downloaded additionally the 4.3 SDK/Simulator and there it works. I used the builts for iOS 5 during beta but finally removed every other developer installation using uninstall-devtools in /Developer/Library but it didn't solve the problem.
Console says:
Process: SpringBoard [4764]
Path: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/CoreServices/SpringBoard.app/SpringBoard
Identifier: SpringBoard
Version: ??? (???)
Code Type: X86 (Native)
Parent Process: iPhone Simulator [4748]
Date/Time: 2011-10-31 14:45:25.541 +0100
OS Version: Mac OS X 10.7.2 (11C74)
Report Version: 9
Crashed Thread: 6
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: 0x000000000000000a, 0x000000000bf33000
VM Regions Near 0xbf33000:
__LINKEDIT 000000000bf29000-000000000bf33000 [ 40K] r--/rwx SM=COW /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Resources/libRIP.A.dylib
--> mapped file 000000000bf33000-000000000bf42000 [ 60K] r--/r-x SM=PRV /Network/*/*.cpbitmap
__TEXT 000000000bf42000-000000000bf8f000 [ 308K] r-x/rwx SM=COW /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Resources/libCGFreetype.A.dylib
Application Specific Information:
iPhone Simulator 272, iPhone OS 5.0 (iPhone/9A334)
Thread 6 Crashed:
0 QuartzCore 0x01ce06b5 void CA::OGL::SW::image_sampler<CA::OGL::SW::Format::ARGB8_Host, false, false, false, false>(CA::OGL::SW::SamplerData const*, unsigned int, unsigned int*) + 64
1 QuartzCore 0x01cda0fa CA::OGL::SW::sample_texture(CA::OGL::SW::Texture const*, int, unsigned int, CA::OGL::SW::Poly::Vertex const*, CA::OGL::SW::Poly::Vertex const*, CA::OGL::SW::Poly::Vertex const*, CA::OGL::SW::Poly::Vertex const*, unsigned char, unsigned int, unsigned int*) + 686
2 QuartzCore 0x01cdbc4b CA::OGL::SW::scanline(CA::OGL::SW::ScanState const*, int, int, int, CA::OGL::SW::Poly::Vertex*, CA::OGL::SW::Poly::Vertex const*, CA::OGL::SW::Poly::Vertex*, CA::OGL::SW::Poly::Vertex const*, unsigned int) + 1172
3 QuartzCore 0x01cdd3bd CA::OGL::SW::scan_convert_thread(void*, void*) + 3009
4 QuartzCore 0x01cff92f CA::DispatchGroup::dispatch(bool) + 191
5 QuartzCore 0x01cff969 CA::DispatchGroup::callback_1(void*) + 25
6 libdispatch.dylib 0x047944e6 _dispatch_worker_thread2 + 284
7 libsystem_c.dylib 0x9930db24 _pthread_wqthread + 346
8 libsystem_c.dylib 0x9930f6fe start_wqthread + 30
I had a similar problem that occurred on the simulator in 4.3 and 5.0. I was finally able to squash it by removing an unnecessary call to [self setNeedsDisplay] in the setFrame selector of a subclass of UIView that was set up to return a CATiledLayer in response to its class method +(Class)layerClass.
It's a problem in CATiledLayer where the call of the static method (Class)layerClass. and specifically in the initialization function where you set the size of the tileSize. make sure it's not 0;
Go to Xcode -> Preferences -> Downloads
Make sure your target SDK you have set in your project is installed in Xcode.
I am getting leak and I cannot detect from where this is happening. The stack trace does not give full info after dyld open. For few leaks I am not getting any stack trace info. All I get is only object memory address. Is anyone else facing the same issue. I am using XCode 3.2 on show leopard.
18 0x103038
17 0x1033c7
16 0x1034a1
15 0x90145f48
14 dyld dlopen
13 dyld dyld::link(ImageLoader*, bool, ImageLoader::RPathChain const&)
12 dyld ImageLoader::link(ImageLoader::LinkContext const&, bool, bool, ImageLoader::RPathChain const&)
11 dyld ImageLoader::recursiveLoadLibraries(ImageLoader::LinkContext const&, bool, ImageLoader::RPathChain const&)
10 dyld dyld::libraryLocator(char const*, bool, char const*, ImageLoader::RPathChain const*)
9 dyld dyld::load(char const*, dyld::LoadContext const&)
8 dyld dyld::loadPhase0(char const*, dyld::LoadContext const&, std::vector<char const*, std::allocator<char const*> >*)
7 dyld dyld::loadPhase1(char const*, dyld::LoadContext const&, std::vector<char const*, std::allocator<char const*> >*)
6 dyld dyld::loadPhase3(char const*, dyld::LoadContext const&, std::vector<char const*, std::allocator<char const*> >*)
5 dyld dyld::loadPhase4(char const*, dyld::LoadContext const&, std::vector<char const*, std::allocator<char const*> >*)
4 dyld dyld::loadPhase5(char const*, dyld::LoadContext const&, std::vector<char const*, std::allocator<char const*> >*)
3 dyld dyld::mkstringf(char const*, ...)
2 dyld strdup
1 dyld mallocenter
I'm seeing very similar behavior in xcode 3.2. The dyld leak, that didn't appear in xcode 3.1.x, and I'm not seeing anything other than a memory address for any other leaks. Just to prove I wasn't crazy, I instantiated several UILabels using alloc and didn't release them. Sure enough, xcode shows UILabel leaks, but the stacktrace is only memory addresses. In 3.1.x I used to see a stack that was much more meaningful, complete with class names. Is this a bug in the new xcode?