0
votes

I am trying to load a nib file from MainViewController but i get an exception which i mentioned below. I am not getting this exception regularly (1 out of fifty times). Check the exception below

Exception :

 Could not load NIB in bundle: 'NSBundle </private/var/mobile/Containers/Bundle/Application/38ABE26C-F87E-49F1-9F29-E46E7ACDBD54/E2_IOS_App.app> (loaded)' with name 'NetWorkError'

the code i use to present this nib file is

NetWorkError *error=[[NetWorkError alloc]initWithNibName:@"NetWorkError" bundle:nil];
                    error.errorMessage=[details serverDownMessage];   // passing some message before presenting .
                    [self presentViewController:error animated:YES completion:nil];

i am using an iPad running with iOS 7.

People with similar issues where asked to check the nib name , check if the .xib is added to target, check if the .xib is added to copy bundle resource.But every thing is correct for me. what else might be the issue ??.

1
have the view property been connected properly to the view in IB? - holex
I am able to load the .xib 49 out of 50 times - vishnuvarthan
Unrelated, but you should seriously consider renaming your classes to reflect what they are, NetWorkError would be a good name for an actually error, NetworkErrorViewController is a good name for a viewController that displays a network error. Error is a common name for an NSError. Also if serverDownMessage is a property, use dot syntax, not method syntax. Poor naming conventions can sometimes lead to issues themselves, so it's good to keep good habits. - TheCodingArt
Since NetWorkError is a UIViewController, can you try loading it from the storyboard and see if you have similar issues? You may not have rigged up the file owner and such correctly (in that case you may just want to re create it). - TheCodingArt

1 Answers

0
votes

Have you tried NSStringFromClass([NetWorkError class]) ?

Also you can try to exclude and add file to your project again / clean project / delete app from simulator.