Could not load NIB in bundle - swift 3 (only physical device) - swift

My app works perfectly on the simulator, but as soon as I launch it on my physical device, I get this exception:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </var/containers/Bundle/Application/E1868188-8412-40F9-AD77-B4CA9DA47415/Aremiti.app> (loaded)' with name '0mX-RV-bpN-view-yyb-5A-n89''
*** First throw call stack:
(0x184b52fe0 0x1835b4538 0x184b52f28 0x18b18a600 0x18afeb2d4 0x18adb546c 0x18ad84c6c 0x18ac83b68 0x18ac83a9c 0x1000e5494 0x1000e34a4 0x1000e3524 0x18b18b8d8 0x18b2d9a50 0x18b2d9790 0x18b18b57c 0x18b18bd1c 0x18b2d9a50 0x18b2d9bc8 0x18b2d9790 0x18b18a8bc 0x18b444f54 0x18af08488 0x18acf4e94 0x18af070c4 0x18af1bd18 0x18af04474 0x1866fb884 0x1866fb6f0 0x1866fbaa0 0x184b0142c 0x184b00d9c 0x184afe9a8 0x184a2eda4 0x18acee384 0x18ace9058 0x1000f62b8 0x183a3d59c)
libc++abi.dylib: terminating with uncaught exception of type NSException
I am aware that this may be thrown when a file's name is changed outside of xcode. However, I haven't touched any of the file names.

let customView = Bundle.main.loadNibNamed("SomeNib", owner: self, options: nil)?[0] as! myClass
probability you NIB name is wrong you...please check your nib name which you made ..you should include SomeNib.xib in loadNibNamed
you should also have to check whether your SomeNib.xib copy into Copy Bundle Resources in Build Phases section of project target ?

I encountered similar error and the reason was that a subView to the current view (self.view.addSubView) was being added in the class's initializer method (when using a storyboard). Moving the code to viewDidLoad fixed it.

Related

My xcode project doesn't add me a .png image

I was trying to add new images into my xcode project in order to make my app universal, adding images for iphone. When compiling, this is the error:
2013-02-26 08:58:35.585 XXXX[2132:707] cocos2d: Couldn't add XXXX-XXX.png in CCTextureCache
2013-02-26 08:58:35.598 XXXXX[2132:707] *** Assertion failure in -[MainMenuLayer addChild:], /Users/XXXX/XXXXX/XXXXX/XXXXX/XXXX/cocos2d/CCNode.m:362
2013-02-26 08:58:35.632 XXXXXX[2132:707] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Argument must be non-nil'
*** First throw call stack:
(0x336c68bf 0x301ba1e5 0x336c67b9 0x30f0d3b3 0x4abef 0xf6495 0x49279 0xcbc8d 0x49279 0xca7cd 0x6413d 0x6bd6b 0x98ff9 0x9a39b 0x34dab423 0x34dab379 0x31940f93 0x36c46891 0x3368ff43 0x3369a553 0x3369a4f5 0x33699343 0x3361c4dd 0x3361c3a5 0x37d8efcd 0x3107f743 0xc90fb 0x3df8)
terminate called throwing an exception
someone knows what happens?
The file name you specified is more than likely not the same as the actual filename. You will see this error if you try adding a file that xcode cannot find. Double check the file names and make sure that you have:
added the file to your project (File->Add Files to xxxx)
The file name of the file added is exactly the same as the file you
are trying to add to MainMenulayer (It is case sensitive)
You have also included the file extension (.png) in the code used to add the png to
MainMenuLayer

HelloWorld for iOS application in creating IOS gettting started, i have unknown exception in the running time

I am trying to implement the getting started helloWorld, on XCode 4.6, but I am getting this sigabart. The code is exactly like the apple website. No errors are produced but in runtime I have this:
2013-02-11 12:38:42.594 hellooWorld[1794:c07] *** Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[<ViewController 0x75562d0> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key greeting.'
*** First throw call stack:
(0x1c91012 0x10cee7e 0x1d19fb1 0xb7ae41 0xafc5f8 0xafc0e7 0xb26b58 0x230019
0x10e2663 0x1c8c45a 0x22eb1c 0xf37e7 0xf3dc8 0xf3ff8 0xf4232 0x433d5
0x4376f 0x43905 0x4c917 0x1096c 0x1194b 0x22cb5 0x23beb 0x15698 0x1becdf9
0x1becad0 0x1c06bf5 0x1c06962 0x1c37bb6 0x1c36f44 0x1c36e1b 0x1117a 0x12ffc
0x267d 0x25a5)
libc++abi.dylib: terminate called throwing an exception
I did delete the connections and connect the label, textfield and button again to view controller.m but get the same result. I connectted the textfiled to the delegate but received the same result.
Can someone help elucidate what is going on?
Check for the linking of objects or methods in your storyboard connections inspector.

Crash when change view (not always)

I have a problem, and it is the first time that I have gotten this error. I have a navigation based app with a database. The app reads the database and displays the content. Sometimes, when I go back in the navigationcontroller I get this error:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle /Users/kikko/Library/ApplicationSupport/iPhone Simulator/5.1/Applications/2A14BA37-78AB-47A9-B92B-5166D6C76B50/FlagsQuiz.app (loaded)' with name 'Bandiera''
First throw call stack:
(0x15a1022 0x1732cd6 0x1549a48 0x15499b9 0x303638 0x1a91fc 0x1a9779 0x1a999b 0x1a8fec 0x1cff1d 0x1ba1cb 0x1d0df1 0x1d0ea9 0x3ca508 0x187401 0x18808b 0x3c9d6c 0x1b0857 0x1b09bc 0x1b09fc 0x7f19 0x15a2e99 0xe514e 0xe50e6 0x18bade 0x18bfa7 0x18b266 0x10a3c0 0x10a5e6 0xf0dc4 0xe4634 0x148bef5 0x1575195 0x14d9ff2 0x14d88da 0x14d7d84 0x14d7c9b 0x148a7d8 0x148a88a 0xe2626 0x2182 0x20f5 0x1)
terminate called throwing an exception(lldb)
What could be the problem?
The problem is in your NIB or in the class Bandiera. Check twice this files in your target.
Here is related question NSInternalInconsistencyException Could not load nib in bundle

this class is not key value coding-compliant for the key view [duplicate]

This question already has answers here:
Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?
(79 answers)
Closed 7 years ago.
i´m very new to xcode... a made an app (simple calculator) work´s pretty good (on simulator and device).
When i set the main interface in the summary options from Target, i get the following error when starting the simulator:
2012-04-14 12:17:27.123 CalcTest[27550:f803] * Terminating app due
to uncaught exception 'NSUnknownKeyException',
reason:
'[<UIApplication 0x6a14650> setValue:forUndefinedKey:]: this class is
not key value coding-compliant for the key calculatorScreen.'
* First throw call stack: (0x12db022 0x18f8cd6 0x12daee1 0xcc2022 0xc33f6b 0xc33edb 0xc4ed50 0x53671a 0x12dcdea 0x12467f1 0x53526e
0x536eb7 0x313ce1 0x313ff8 0x31317f 0x322183 0x322c38 0x316634
0x27fcef5 0x12af195 0x1213ff2 0x12128da 0x1211d84 0x1211c9b 0x312c65
0x314626 0x1bad 0x1b15 0x1) terminate called throwing an
exception(lldb)
to find the problem, i started a new view based project.
Run the empty new project on the simulator -->works,
But when I set the main interface, to ViewController, in the summary -->the Simulator crash with
2012-04-14 12:11:17.492 crash[27494:f803] * Terminating app due to uncaught
exception 'NSUnknownKeyException', reason:
'[<UIApplication 0x6a6f4b0> setValue:forUndefinedKey:]: this class is
not key value coding-compliant for the key view.'
* First throw call stack:
(0x13c7022 0x1558cd6 0x13c6ee1 0x9bf022 0x930f6b 0x930edb 0x94bd50
0x23371a 0x13c8dea 0x13327f1 0x23226e 0x233eb7 0x10ce1 0x10ff8 0x1017f
0x1f183 0x1fc38 0x13634 0x12b1ef5 0x139b195 0x12ffff2 0x12fe8da
0x12fdd84 0x12fdc9b 0xfc65 0x11626 0x1d4d 0x1cb5) terminate called
throwing an exception
is there a solution for the problem?
If you have a control in your nib (xib file) that is linked to a property (IBOutlet) or method (IBAction) in your view controller, and you have either deleted or renamed the property or method, the runtime can't find it because it has been renamed and therefore crashes.
In your case, you have set the Main Interface property of the project to your ViewController.nib. This is a problem because the only nibs that should be used as Main Interface should have UIWindows in them and the File Owner in that nib should be set to the AppDelegate. The UIWindow in the nib should be linked to the File Owner's (AppDelegate) window property. Because you set that with a nib without the traits the runtime was looking for, it gives you this error.
The solution is to leave the Main Interface blank as you do not have to set up UIWindows manually anymore.
Just had the same problem and fixed it by right Control-Clicking controls in the xib file to see referencing Outlets. Turned-out that some of the control were still referencing and older name and causing this error to happen.
if you get a message similar to:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason:
'[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key
click the add (+) at the left bottom corner of the BreakPoint navigation area, choose 'add Exception Breakpoint', since it is crashing because of 'NSUnknownKeyException', and opt for 'All'. Run the program. The program stops at the first exception.
try this, select File's Owner then click on the "Connection Inspector" (upper on the top of right pane), you will see all the outlets. Look for any sign like this (!) you will find it on the small circle which indicates a missing outlet, all you have to do is linking it properly or remove the outlet.
Try this,
Go to Target=>Build Phases=>Compile Sources
Then include 'calculatorScreen.m'
I was facing the same problem. In my case i had renamed the text label in .h file. So there was multiple reference for that label in my main.storyboard file. Once i removed old reference my code started working.
Please check your target membership
select first option.this may help to others

code crashes when adding view

I copied all my iphone viewcontroller files into an a new iPad project. (I changed the sizes of each nib files etc.)
Almost all viewControllers are working except for one viewcontroller say xview.
At the line [self.view add:xview.view] the code crashes with the following log
2011-06-22 14:08:56.435 RelaxInAMinutePad[5073:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
2011-06-22 14:08:56.437 RelaxInAMinutePad[5073:207] Stack: (
47421520,
48579372,
47159051,
47158890,
1569479,
1563144,
19971,
20321,
19638,
23235,
4095877,
30247,
5636593,
3472622,
3970110,
3979456,
3970037,
3472622,
3970110,
3979456,
3974253,
3599848,
3491395,
3523032,
56414588,
46700700,
46696616,
56408221,
56408418,
3515250,
8984,
8838
)
terminate called after throwing an instance of 'NSException'
I am not using any URL or anything from my code.
I am not getting why this is caused. I am sure this is not about coding but some thing to do with resources or IB.
what may be the mistake and how to rectify?
Read the console:
reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
Somewhere you are trying to instantiate an NSURL object, but the string you pass into it is nil.
check your line
[self.view add xview.view]
it should be
[self.view addSubview xview.view]
Maybe you not add Nib-file in new project, or any other resource files...