如何理解这次崩溃?

时间:2014-05-15 14:08:40

标签: objective-c xcode crash-reports

崩溃报告:

0   ??? 0x0 + 0 
1   TestPrj -[AppListReader addInstalledApps:] (AppListReader.m:186) + 77516    
2   TestPrj -[AppListReader getAppsInstalled] (AppListReader.m:161) + 77320 
3   TestPrj -[DetectAppsInstalledService activate:] (DetectAppsInstalledService.m:48) + 197612  
4   TestPrj -[BusinessManager handleBG] (BusinessManager.m:762) + 116672    
5   TestPrj -[BusinessManager activate:] (BusinessManager.m:208) + 106236   
6   TestPrj -[AppDelegate launchViewController:] (AppDelegate.m:338) + 32564    
7   TestPrj -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:153) + 27396   
8   UIKit   <redacted> + 316    
9   UIKit   <redacted> + 1564   
10  UIKit   <redacted> + 772    
11  UIKit   <redacted> + 3316   
12  UIKit   <redacted> + 104    
13  UIKit   <redacted> + 672    
14  GraphicsServices    <redacted> + 676    
15  GraphicsServices    <redacted> + 48 
16  CoreFoundation  <redacted> + 56 
17  CoreFoundation  <redacted> + 444    
18  CoreFoundation  <redacted> + 1620   
19  CoreFoundation  CFRunLoopRunSpecific + 452  
20  UIKit   <redacted> + 784    
21  UIKit   UIApplicationMain + 1156    
22  TestPrj main (main.m:21) + 23548    
23  libdyld.dylib   <redacted> + 4

第186行是:

NSMutableArray *allObjetcsArr = [self getInstalled];

这是实施:

-(NSMutableArray *)getInstalled
{
    NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:@"ApplicationType",@"Any", [self defaultReturnAttributes] ,@"ReturnAttributes",nil];

    MobileInstallationLookup = dlsym(RTLD_DEFAULT, "MobileInstallationLookup");
    NSDictionary *apps = (__bridge NSDictionary *)((__bridge void*)MobileInstallationLookup(options));

    NSMutableArray *allObjetcsArr = [[NSMutableArray alloc]initWithArray:[apps allValues]];

    return allObjetcsArr;
}

通过BugSense收到崩溃,我无法重现它。我认为它与MobileInstallationLookup框架(私有api)有关,但我不确定。

我不清楚为什么

-(NSMutableArray *)getInstalled

堆栈跟踪中不存在,只有??? 0x0 + 0

1 个答案:

答案 0 :(得分:2)

我的钱就在这些方面:

MobileInstallationLookup = dlsym(RTLD_DEFAULT, "MobileInstallationLookup");
NSDictionary *apps = (__bridge NSDictionary *)((__bridge void*)MobileInstallationLookup(options));
  • MobileInstallationLookup显然是一个全球性的,但不清楚为什么;例如,如果它是全局的,为什么它会在这个方法中重新分配,为什么变量以大写字母开头(这是非常规的)?
  • 没有检查以确保dlsym()成功,并且取消引用空指针会导致您遇到崩溃。