iphone - 在 NSUserDefaults 中设置值时崩溃

标签 iphone ios objective-c

我有这个堆栈跟踪:

0 LiveTexOpClient 0x000b3d3a testflight_backtrace + 382
1 LiveTexOpClient 0x000b4988 TFSignalHandler + 264
2 libsystem_c.dylib 0x3c4d0e92 _sigtramp + 42
3 CoreFoundation 0x342edb4f CFBasicHashFindBucket + 1891
4 CoreFoundation 0x342edb4f CFBasicHashFindBucket + 1891
5 CoreFoundation 0x342eea8a CFDictionaryGetValue + 82
6 CoreFoundation 0x343357a6 -[CFXPreferencesPropertyListSource setValue:forKey:] + 38
7 CoreFoundation 0x34335722 _CFXPreferencesSetValue + 134
8 CoreFoundation 0x34335600 CFPreferencesSetAppValue + 40
9 Foundation 0x34c1c906 -[NSUserDefaults(NSUserDefaults) setObject:forKey:] + 82
10 LiveTexOpClient 0x0006db28 -[LTAuthorizationManager saveLatestSessionTimeStamp] (LTAuthorizationManager.m:390)
11 LiveTexOpClient 0x0002d7aa -[LTAppDelegate applicationWillResignActive:] (LTAppDelegate.m:48)
12 UIKit 0x36209fb4 -[UIApplication _deactivateForReason:notify:] + 400
13 UIKit 0x3623ff2a -[UIApplication _handleApplicationSuspend:eventInfo:] + 314
14 UIKit 0x361b61e6 -[UIApplication handleEvent:withNewEvent:] + 2458
15 UIKit 0x361b56cc -[UIApplication sendEvent:] + 72
16 UIKit 0x361b511a _UIApplicationHandleEvent + 6154
17 GraphicsServices 0x37eb85a2 _PurpleEventCallback + 590
18 GraphicsServices 0x37eb81d2 PurpleEventCallback + 34
19 CoreFoundation 0x34382172 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
20 CoreFoundation 0x34382116 __CFRunLoopDoSource1 + 138
21 CoreFoundation 0x34380f98 __CFRunLoopRun + 1384
22 CoreFoundation 0x342f3ebc CFRunLoopRunSpecific + 356
23 CoreFoundation 0x342f3d48 CFRunLoopRunInMode + 104
24 GraphicsServices 0x37eb72ea GSEventRunModal + 74
25 UIKit 0x36209300 UIApplicationMain + 1120
26 LiveTexOpClient 0x0002e144 main (main.m:14)
27 LiveTexOpClient 0x0002d28f start + 39

代码来自:

-(void)saveLatestSessionTimeStamp
{
    [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithDouble:[[NSDate date] timeIntervalSince1970]] forKey:self.savedLogin];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

崩溃只发生在五分之二的设备上。 它在两个 iphone (ios 6.1.3) 上安装,但没有在另一个 iphone (相同的 ios 6.1.3!) 上安装。 谁能帮帮我?

最佳答案

  1. self.savedLogin 是否为零?
  2. self.savedLogin 是一个 NSString 吗?

关于iphone - 在 NSUserDefaults 中设置值时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17726346/

相关文章:

iphone - 正确清除对象 "getters should not be used for side effects"

ios - 使用 Core Motion 准确跟踪用户围绕对象旋转的度数

iphone - 我如何使用相同的导航 Controller 从不同的单元格转到不同的 View Controller ?

iphone - 无法在 Objective-C 中访问 JSON 数据

ios - 将 ImageView 放入 Collection View 单元格导致 IBTool 发出警告

javascript - 使用 Phonegap 为 iPhone 生成 PDF

iphone - 如何从 iOS 中包含图像的 URL 获取数据?

ios - 如果我的 iPhone 当时没有信号,我会错过应用程序通知吗

ios - 静态 UITableViewCell 的 contentView 中带有 UITextField 的模糊布局

iphone - 当我确实需要使用 [NSThread sleepForTimeInterval :1];