在进入appDelegate

时间:2017-04-25 09:50:36

标签: ios swift nsuserdefaults nsexception

我认为它来自userDefaults,但不确定原因?

- [__ NSCFData _getCString:maxLength:encoding:]:无法识别的选择器发送到实例0x61100002ffc0

 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFData _getCString:maxLength:encoding:]: unrecognized selector sent to instance 0x61100002ffc0'

*** First throw call stack:
(
    0   CoreFoundation                      0x0000000103a69d4b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x0000000102fc721e objc_exception_throw + 48
    2   CoreFoundation                      0x0000000103ad9f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   CoreFoundation                      0x00000001039ef005 ___forwarding___ + 1013
    4   CoreFoundation                      0x00000001039eeb88 _CF_forwarding_prep_0 + 120
    5   CoreFoundation                      0x00000001039a389b CFStringGetCString + 171
    6   CoreFoundation                      0x00000001039b377d CFLocaleCreateCanonicalLocaleIdentifierFromString + 77
    7   CoreFoundation                      0x00000001039b3327 _CFLocaleCopyCurrentGuts + 487
    8   CoreFoundation                      0x00000001039b3109 +[NSLocale currentLocale] + 9
    9   Foundation                          0x0000000102a8a376 -[NSUserDefaults(NSUserDefaults) init] + 1637
    10  Foundation                          0x0000000102a89cb5 +[NSUserDefaults(NSUserDefaults) standardUserDefaults] + 81
    11  UIKit                               0x00000001048098df ___UIApplicationMainPreparations_block_invoke_2 + 53
    12  libclang_rt.asan_iossim_dynamic.dylib 0x0000000101d582b4 __wrap_dispatch_async_block_invoke + 260
    13  libdispatch.dylib                   0x00000001078e8978 _dispatch_call_block_and_release + 12
    14  libdispatch.dylib                   0x00000001079120cd _dispatch_client_callout + 8
    15  libdispatch.dylib                   0x00000001078f365f _dispatch_root_queue_drain + 1450
    16  libdispatch.dylib                   0x00000001078f3059 _dispatch_worker_thread3 + 123
    17  libsystem_pthread.dylib             0x0000000107cbb4de _pthread_wqthread + 1129
    18  libsystem_pthread.dylib             0x0000000107cb9341 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

//将我的密钥存储为

struct user {    
    static let shared = user()
    let username:String = "user_username"
    let password:String = "user_password"
    let mobile:String = "user_mobile"
    let email:String = "user_email"
    let fname:String = "user_fname"
    let lname:String = "user_lname"
    let lastSync:String = "user_sync"
    let id:String = "user_employeeId"
    let empRole:String = "user_role"
    let empManager:String = "user_manager"
    let empFinance:String = "user_finance"
}

Thanks in Advance

0 个答案:

没有答案