应用程序仅在iPhone设备上崩溃而不在模拟器中崩溃 [英] App crash only on iPhone Device and not in Simulator

查看:146
本文介绍了应用程序仅在iPhone设备上崩溃而不在模拟器中崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,当我按下按钮时,调用该按钮的方法首先将我的文本域文本直接分配给 NSArray 对象,如:

In my app, when I press a button the method called for that button first assigns my textfield texts directly to NSArray object like:

 val = [[NSArray alloc] initWithObjects: nameText.text, cellText.text, p_emText.text, 
                                      p_cnfrmText.text, s_emText.text, s_cnfrmText.text,
                                      emailText.text, ecnfrmText.text, lat, longt,  
                                      nil];

当我在模拟器上运行我的应用程序时没有发生应用程序崩溃,但是当我在我的iPhone设备上运行它时它给出:线程1:程序收到的信号EXC_BAC_ACCESS

when I run my app on simulator no app crashing occurs, but when I run it on my iPhone device it gives: Thread 1: program recieved signal "EXC_BAC_ACCESS"

任何人都可以告诉为什么会发生这种情况以及解决方案是什么对于这种情况?

Can anybody tell why this happens and what's the solution for this scenario?

推荐答案

使用 initWithObjects 创建数组所涉及的所有对象应该是实际的对象。你的问题中没有足够的代码知道 lat longt 是否也是对象。是吗?

All objects involved in array creation using initWithObjects should be actual objects. There is no enough code in your question to know if lat and longt are objects too. Are they?

如果不是,请用 [NSNumber numberWithFloa:< #the float#> ]换行。

If they aren't, wrap them with [NSNumber numberWithFloa:<# the float #>].

如果这不是问题,请检查有关 EXC_BAC_ACCESS 的SO问题,以学习调试它们。

If that's not the problem, check SO questions regarding EXC_BAC_ACCESS to learn to debug them.

这篇关于应用程序仅在iPhone设备上崩溃而不在模拟器中崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆