0

I have created a custom cell through nib and applied some constraints on it. Moving forward, I replaced that nib file with some old state of nib by replacing it in finder. Also all outlets and constraints are removed; Means, there is no any constraints and outlets now present. After running the code, exception and crash is coming.

code=exc_i386_invop subcode=0x0

Afterwards, i removed all the things in nib file; Now nib is entirely empty. I have double checked, no any outlet attached with that nib.

I am sure, something happen with copying and pasting the nib; Now i have to remove the nib file, and create new nib file then it will work again.

Please let me know if anyone also faced this type of problem?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
msmq
  • 1,298
  • 16
  • 28
  • Are you getting any warning message in console? Also check what you have set for files owner for the nib, and add the code you are using to load the cell – Johnykutty Feb 22 '16 at 05:45
  • There is no warning message in console. Even i have removed old nib file and create new one but still crashing; Issue occurred when you copy anything from any nib and paste it in nib; For Example any UILabel/Whole nib items. – msmq Feb 22 '16 at 08:49

1 Answers1

0

I have found the solution; As i copy and past the content of xib file from one xib to another xib, there is possibility that in next xib's .swift file contains any @IBOutlet that is not present in copied xib file;

For Example:

@IBOutlet var profilePicture: UIImageView!
@IBOutlet var coverPicture: UIImageView!
@IBOutlet var personName: UILabel!
@IBOutlet var jobTitle: UILabel!
@IBOutlet var currentLocation: UILabel!

There all outlets are non-optionals; So if anyone of them not linked in xib file, then at run time app will crash; So have to double check for IBOutlets; So that the outlets which are not used in .swift file, you need to remove them or make them optional with '?' keyword.

msmq
  • 1,298
  • 16
  • 28