简体   繁体   English

IOS6中的NSDictionary问题?

[英]NSDictionary issue in IOS6?

Facing Strange issue when i am trying to call next Class my app crashed in IOS6 only when i tested my app in IOS5 and IOS7 its working fine .Crash screen shot 当我尝试调用下一个类时遇到奇怪的问题,只有当我在IOS5和IOS7中测试我的应用程序时,我的应用程序才在IOS6中崩溃。

在此处输入图片说明

When i googled this issue i got the following Solutions but single one did not help me to Resolve my problem. 当我用谷歌搜索这个问题时,我得到了以下解决方案,但是没有一个解决了我的问题。

here is my code where it is Crashing 这是我的代码崩溃

-(IBAction)notesMethod{
NotesClass *notes = [[NotesClass alloc] initWithNibName:@"NotesClass" bundle:nil];

[self presentViewController:notes animated:YES completion:nil];
}


- (void)viewDidLoad
{

NSArray *arrTemp1 = [[NSArray alloc]initWithObjects:@"Single Event Probability", @"Mutiple Event Probability",@"Permutation", @"Combination",nil];

NSArray *arrTemp2 = [[NSArray alloc]initWithObjects:@"Bionomial Distribution",@"Negativ Bionomial Distribution",@"Hypergeometric Distribution",@"Comulative Hypergeometric Distribution",@"Poission Distribution",@"Multinomial Distribution",nil];

NSArray *arrTemp3 = [[NSArray alloc]initWithObjects:@"Uinform Distribution",@"Exponential Distribution",@"Gamma Distribution",@"Gamma Function", @"Beta Distribution", @"Beta Function", @"Standard Normal Distribution",@"PDF of Normal Distribution", @"Z-Table", nil];

NSDictionary *temp =[[NSDictionary alloc]initWithObjectsAndKeys:arrTemp2,@"Discreet Probability Distribution",arrTemp3,@"Continuouse Probability Distribution",arrTemp1,@"Probability",nil];
 }

Before presenting the next view my app get Crashed. 在呈现下一个视图之前,我的应用已崩溃。 when i read about Thread 1: signal SIGABRT its all about xib issue,i am sure there is no problem in my xib file. 当我阅读有关线程1的信号时,请向SIGABRT发出有关xib问题的所有信息,我确定我的xib文件中没有问题。

Crash output 崩溃输出

StatisticCal[3091:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSDictionary initWithObjects:forKeys:]: count of objects (0) differs from count of keys (3)'
 *** First throw call stack:

(0x1886012 0x1439e7e 0x1891737 0xe456d6 0xe6af79 0xe6c507 0xe43c85 0xe6af79 0xe69e97 0xeb67c1 0xf688d3 0xe6af79 0xe69e97 0x4b78c4 0xe6af79 0xe69e97 0x59d648 0xe6af79 0xe6c507 0xe43c85 0xe6af79 0xe69e97 0x59caa3 0x461e37 0x462418 0x462648 0x462882 0x46e235 0x66d3d2 0x46b4f3 0x46b777 0x184cb 0x144d705 0x384920 0x5c0b24 0x144d705 0x384920 0x3848b8 0x445671 0x445bcf 0x444d38 0x3b433f 0x3b4552 0x3923aa 0x383cf8 0x16d0df9 0x16d0ad0 0x17fbbf5 0x17fb962 0x182cbb6 0x182bf44 0x182be1b 0x16cf7e3 0x16cf668 0x38165c 0x6fbc 0x6f55) libc++abi.dylib: terminate called throwing an exception (0x1886012 0x1439e7e 0x1891737 0xe456d6 0xe6af79 0xe6c507 0xe43c85 0xe6af79 0xe69e97 0xeb67c1 0xf688d3 0xe6af79 0xe69e97 0x4b78c4 0xe6af79 0xe69e97 0x59d648 0xe6af79 0xe6c507 0xe43c85 0xe6af79 0xe69e97 0x59caa3 0x461e37 0x462418 0x462648 0x462882 0x46e235 0x66d3d2 0x46b4f3 0x46b777 0x184cb 0x144d705 0x384920 0x5c0b24 0x144d705 0x384920 0x3848b8 0x445671 0x445bcf 0x444d38 0x3b433f 0x3b4552 0x3923aa 0x383cf8 0x16d0df9 0x16d0ad0 0x17fbbf5 0x17fb962 0x182cbb6 0x182bf44 0x182be1b 0x16cf7e3 0x16cf668 0x38165c 0x6fbc 0x6f55)libc ++ abi.dylib:终止称为抛出异常

any suggestion will be appreciated.thanks 任何建议将不胜感激。

Error message: 错误信息:

StatisticCal[3091:c07] ** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '** -[NSDictionary initWithObjects:forKeys:]: count of objects (0) differs from count of keys (3) ' StatisticCal [3091:c07] **由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'**-[NSDictionary initWithObjects:forKeys:]: 对象数(0)与键数(3)不同 ''

The number of objects and keys when creating a dictionary are not the same. 创建字典时对象和键的数量不同。 That should help you find the error. 那应该可以帮助您找到错误。

This could also me a memory issue where you are accessing a released object. 这也可能是您访问释放对象时出现的内存问题。 Released objects are not immediately overwritten and when the reuse occurs can be random which would explain why sometimes it works and sometimes not. 释放的对象不会立即被覆盖,重用发生的时间可以是随机的,这可以解释为什么有时起作用而有时不起作用。

Add an exception breakpoint, when it is hit continue to get more information. 添加一个异常断点,当它被击中时继续获取更多信息。 To add the breakpoint select breakpoints in the Navigator select breakpoints, click on the "+" in the lower left of the Xcode window, select "Add Exception Breakpoint". 要在浏览器选择断点中添加断点选择断点,请单击Xco​​de窗口左下方的“ +”,选择“添加例外断点”。

As an aside, here is a nice way to format your data (just playing here): 顺便说一句,这是格式化数据的好方法(只是在这里播放):

NSArray *arrTemp1 = @[@"Single Event Probability",
                      @"Mutiple Event Probability",
                      @"Permutation",
                      @"Combination"];

NSArray *arrTemp2 = @[@"Bionomial Distribution",
                      @"Negativ Bionomial Distribution",
                      @"Hypergeometric Distribution",
                      @"Comulative Hypergeometric Distribution",
                      @"Poission Distribution",
                      @"Multinomial Distribution"];

NSArray *arrTemp3 = @[@"Uinform Distribution",
                      @"Exponential Distribution",
                      @"Gamma Distribution",
                      @"Gamma Function",
                      @"Beta Distribution",
                      @"Beta Function",
                      @"Standard Normal Distribution",
                      @"PDF of Normal Distribution",
                      @"Z-Table"];

NSDictionary *temp = @{@"Probability"                          : arrTemp1,
                       @"Discreet Probability Distribution"    : arrTemp2,
                       @"Continuouse Probability Distribution" : arrTemp3};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM