我很难诊断应用程序崩溃。我已经查看了Debug导航器,但我不确定如何阅读所有信息。这就是我所拥有的。
在代码中我收到此错误:
Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP,subcode=0x0
在调试导航中,我看到了:
3 DispenseScreenTwoViewController.prepareForSegue(UIStoryboardSegue, sender : AnyObject!) -> ()
当我将鼠标悬停在我创建的变量数组上以转移到下一个视图控制器时,我看到了:
@"6 objects"
六个对象是我填充数组的项目,这里是我认为我的问题可能出现的地方。单击“信息”图标时,以下内容将打印到日志中。我点击了其中一个数组项(数组项1)。调试器显示正确的值(Joe Black)但是当我向下钻取时,我看到一个读取内存错误。数组的[0]值不返回该错误。但是,阵列DO的其他六个值中的两个返回相同的读取存储器错误。
当我点击数组第1项的信息图标时,这是日志中的文字:
Printing description of ((NSTaggedPointerString *)0xa3b0c03ef0883929):
Joe Black
Printing description of (*( (NSString *)0xa3b0c03ef0883929)):
(NSString) NSString = {
NSObject = {
isa = <read memory from 0xa3b0c03ef0883929 failed (0 of 8 bytes read)>
}
}
Printing description of (*( (NSObject *)0xa3b0c03ef0883929)):
(NSObject) NSObject = {
isa = <read memory from 0xa3b0c03ef0883929 failed (0 of 8 bytes read)>
}
Printing description of :
(Class) isa = <read memory from 0xa3b0c03ef0883929 failed (0 of 8 bytes read)>
以下是我创建数组和prepareForSegue
函数的代码:
if blankData != 1 {
//add code to pass data to next veiw controller
enteredDataArrayTwo = [toPassTwo, enterPersonnelName.text!, enterDrugID.text!, enterPackageNumber.text!, enterQty.text!, enterExpDate.text!]
print(enteredDataArrayTwo)
self.appIsWorking()
performSegueWithIdentifier("goToDispenseScreenThree", sender: self)
activityIndicator.stopAnimating()
UIApplication.sharedApplication().endIgnoringInteractionEvents()
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if (segue.identifier == "goToDispenseScreenThree") {
//Checking identifier is crucial as there might be multiple segues attached to same view
let DestViewControllerThree = segue.destinationViewController as! DispenseScreenThreeViewController;
DestViewControllerThree.toPassThree = enteredDataArrayTwo as! [String]
}
}