iphone - 应用程序仅在iPhone设备上崩溃而不在模拟器中崩溃

标签 iphone objective-c ios xcode

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

 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设备上运行它时,它给出了:Thread 1: program recieved signal "EXC_BAC_ACCESS"
谁能说出为什么会发生这种情况,以及这种情况下的解决方案是什么?

最佳答案

使用initWithObjects创建数组涉及的所有对象均应为实际对象。您的问题中没有足够的代码来知道latlongt是否也是对象。是吗

如果不是,请用[NSNumber numberWithFloa:<# the float #>]包裹它们。

如果这不是问题,请检查有关EXC_BAC_ACCESS的问题,以学习对其进行调试。

关于iphone - 应用程序仅在iPhone设备上崩溃而不在模拟器中崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8427516/

相关文章:

iphone - 使用 CGContext 画线

iphone - 从类方法调用 popViewController

iphone - UITableView 中的错误(deleteSections :withRowAnimation: )?

iphone - UIWebView 内的滑动手势识别

iphone - 如何在 iOS 钥匙串(keychain)中添加另一个密码?

ios - 在 Xcode 8 中隐式展开可选分配

ios - 带有错误 : failed to obtain a cell from its dataSource 的 .xib 单元格的 UITableView

ios - 提取CVImageBufferRef的子图像

ios - Twitter API 问题 .“Authentication needed” “无法验证 oauth 签名和 token ”

ios - swift ios 将数据分配给多个警报文本字段