I am using JSQMessages installed through Cocoapods.
I started getting this crashes:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/XXX/Library/Developer/CoreSimulator/Devices/E4479289-9068-420E-8D2E-C147129BD60E/data/Containers/Bundle/Application/81C1166D-426F-4C68-B3FB-89164E2C35DC/XXXXXXXXXX.app> (loaded)' with name 'JSQMessagesViewController''
*** First throw call stack:
(
0 CoreFoundation 0x000000011304434b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000112aa521e objc_exception_throw + 48
2 CoreFoundation 0x00000001130ad265 +[NSException raise:format:] + 197
3 UIKit 0x000000011143901a -[UINib instantiateWithOwner:options:] + 507
4 XXXXXXXXXXXX 0x000000010e2fb3bf -[JSQMessagesViewController viewDidLoad] + 143
Which crashes in this method:
- (void)viewDidLoad
{
[super viewDidLoad];
[[[self class] nib] instantiateWithOwner:self options:nil];
[self jsq_configureMessagesViewController];
[self jsq_registerForNotifications:YES];
}
I have searched and tried every single solution of the many ones proposed in StackOverflow and in other sites, and I have spent two days on it with no success.
Please help me point in the right direction. Thanks!!
I FINALLY solved it by:
Add a new "Copy Bundle resources" phase in the build phases for the pod target.
Pod target -> Editor -> Add Build Phase -> Add Copy Bundle Build
Phase
Manually add all XIB files used by JSQMessages to the created phase, with the + button.
Delete everything in the derived folder
Restart my Mac. Yeah, really, no Magical thinking here. XCode is full of misteries you humans can not decode.