问题
With the stack trace, unsafeMutableAddressor
crash seems to be when it access AppConstant.kShowOverlay
from controller's viewDidLoad()
I have defined AppConstant.swift
like below:
struct AppConstant {
// MARK: Properties
static let kShowOverlay = false
}
Following is the stack trace from crashlytics:
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000048
0 libswiftCore.dylib 0x51bfc5c _TTWuRq_Ss9Indexable_GVSs5Sliceq__Ss14CollectionTypeSsFS1_10suffixFromuRq_S1__fq_Fqq_S_5Indexqq_S1_11SubSequence
1 MyAppModule 0x56fbad4 AppConstants.kShowOverlay.unsafeMutableAddressor (AppConstants.swift)
2 libdispatch.dylib 0x34ba9f13 dispatch_once_f + 62
3 MyApp 0x23e38e8 globalinit_33_D6508E60499748694DF7352631AEB836_func18 (MyViewController.swift:73)
4 libdispatch.dylib 0x34ba92cf _dispatch_client_callout + 22
5 libdispatch.dylib 0x34ba9f13 dispatch_once_f + 62
6 MyApp 0x2383e88 MyViewController.setupCollectionView(MyViewController) -> () -> () (MyViewController.swift:530)
7 MyApp 0x29f0a3c MyViewController.viewDidLoad(MyViewController) -> () -> () (MyViewController.swift:59)
I am not able to repro this crash, just have the stack trace from crashlytics.
Does anyone have any idea like, what could be the reason or how should I try to repro this crash?
Note: Crash only happens on iOS 8.
Any pointers would be greatly appreciated.
Update: My workspace has multiple projects, so the accessor file and the constant file that I am trying to access are in different project. Is there any possibility like project settings mismatch that can cause the crash?
来源:https://stackoverflow.com/questions/37732916/ios-swift-unsafemutableaddressor-crash-on-ios-8