code crashes when adding view - iphone

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...

Related

iOS - Video playing gives errors

When I follow this tutorial, it gives me an error on the [playercontroller release]; line, so I remove it, and then it gives me these errors when I try to run it.
I tried making another app to test the video, and it works seamlessly, but it will not work in my main app. Can anyone help?
And when I reimported the framework, and tried to play the video, it gives me this error:
2012-08-17 11:27:03.174 LYWAM Tour[768:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
*** First throw call stack:
(0x1e15022 0x10fdcd6 0x1dbda48 0x1dbd9b9 0xba253b 0xba24c5 0x54ac 0x1e16e99 0x26314e 0x2630e6 0x309ade 0x309fa7 0x308d8a 0x2882cf 0x2885e6 0x26edc4 0x262634 0x16f7ef5 0x1de9195 0x1d4dff2 0x1d4c8da 0x1d4bd84 0x1d4bc9b 0x16f67d8 0x16f688a 0x260626 0x24cd 0x2435 0x1)
terminate called throwing an exception(lldb)
I take it GVE1ViewController is a class you wrote yourself? Does it definitely implement a method called GrommeVideoExcerpt1? Is what you assigned to the variable actually an instance of GVE1ViewController (or a subclass?) Put in an NSLog to check that it really is an instance of GVE1ViewController.
To do the NSLog, you need a line of the form:
NSLog(#" My controller = %#", myVar);
where myVar is whatever variable you have containing a reference to the GVE1ViewController.

Thread 1: signal SIGABRT xcode 4.4 ios 5.1 objective-c HELP >.<

Ok so yesterday I had some trouble with this error, turned out I just needed to be patient and read through more of the book. This time I have got to the end of the project and I am getting this error at a different point.
I have isolated the line of code causing the issue but I'm not sure what the issue is!
htmlString=[htmlString stringByAppendingString: appDelegate.savedNumber];
Debug console is saying:
2012-08-09 13:06:47.235 tester[1357:c07] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSCFConstantString stringByAppendingString:]: nil argument'
*** First throw call stack:
(0x14b3022 0xeb3cd6 0x145ba48 0x145b9b9 0x941b92 0x29bd 0xdda1e 0x3c401 0x3c670 0x3c836 0x4372a 0x24c2 0x14386 0x15274 0x24183 0x24c38 0x18634 0x139def5 0x1487195 0x13ebff2 0x13ea8da 0x13e9d84 0x13e9c9b 0x14c65 0x16626 0x20e2 0x2055)
terminate called throwing an exception
Anyone have any ideas? :)
It is because appDelegate.savedNumber is nil (does not set) . And why it is nil this is another question.
Looks like exactly what's written, you're passing nil argument to the method. Check if your savedNumber is a valid string object.

NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array' when presenting view controller

I have developed an app that in testing has worked fine but when it has could live I have had some issues with crashes when presenting Modal View Controllers. The issue is in here some where:
NSLog(#"Looks like we made it here 1");
UIViewController *mtaViewController = [self.storyboard instantiateViewControllerWithIdentifier:#"mtaViewController"];
NSLog(#"Looks like we made it here 2");
[mtaViewController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
NSLog(#"Looks like we made it here 3");
[self presentModalViewController:mtaViewController animated:YES];
NSLog(#"Looks like we made it here 4");
and my output to the console is:
2012-06-14 09:26:24.161 appname[2013:707] Looks like we made it here 1
2012-06-14 09:26:24.165 appname[2013:707] Looks like we made it here 2
2012-06-14 09:26:24.166 appname[2013:707] Looks like we made it here 3
2012-06-14 09:26:28.866 appname[2013:707] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(0x343ac8bf 0x345fc1e5 0x342f5b6b 0x6d3fd 0x6e719 0x3778e7ff 0x37798d53 0x37798cc1 0x37838339 0x3783714f 0x37891d97 0x7ce1d 0x7cd47 0x3788eaa5 0x3776a81b 0x3776ffb9 0x34ec1ba7 0x36fe0e8d 0x3437f2dd 0x343024dd 0x343023a5 0x30b86fcd 0x37783743 0x84327 0x6b468)
terminate called throwing an exception
I have set up in a function that I call when wanting to change view controllers and as you can see it makes it all the way down to "Looks like we made it here 3" so I suspect that there is an issue with line
[self presentModalViewController:mtaViewController animated:YES];
Can anyone help?
Check any array in mtaViewController, I dont see any array in your code so I'm thinking the issue is within mtaViewController. :)
Are you sure you view controller really gets initialized? Just an idea but this line
[mtaViewController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
would do nothing if mtaViewController would be nil. In Cocoa you can send messages to nil without problems. Your app only will crash later when you try to do something specific with them. Does
NSLog(#"%#", mtaViewController);
tell you something useful? Please make also sure you connected everything in IB that has to be connected (if you aren't working everything out in raw code).
By the way. This is deprecated. Use
presentViewController:animated:completion:
instead.

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

Unrecognized selector sent to instance on UIViewController

I've got a really annoying problem, and as much as I've searched, I can't find the answer. My app is terminating when I try to view a TableView. The data source and delegate is set to the File's owner, which implements the protocol.
alt text http://grab.by/2IJV
alt text http://grab.by/2IK7
The error I'm getting looks like this:
[Session started at 2010-02-27 16:28:24 +0000.]
2010-02-27 16:28:27.209 Moola[28564:207] Unknown class FirstViewController in Interface Builder file.
2010-02-27 16:28:28.189 Moola[28564:207] *** -[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x5005900
2010-02-27 16:28:28.190 Moola[28564:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x5005900'
2010-02-27 16:28:28.190 Moola[28564:207] Stack: (
40692267,
2469430537,
40961963,
40426854,
40423522,
4542959,
4550376,
4549359,
3202411,
3139508,
3189226,
3176954,
68444159,
68443501,
68441542,
68440628,
68472982,
40444146,
40231701,
40228984,
49023565,
49023762,
2840157,
9184,
9038
)
Finally, here's the implementation file (SettingsController.m) of the SettingsController class:
alt text http://grab.by/2ILu
I'm sure this is a trivial problem for a pro, but I come from a highly web-based background, and only dabbled in C a while a few years back. To be truthful, it's hurting my head.
Thanks,
Jamie
What is FirstViewController as referenced in this disconcerting log line? Could it be some leftover reference that Interface Builder is actually trying to instantiate instead of your SettingsController?
2010-02-27 16:28:27.209 Moola[28564:207] Unknown class FirstViewController in Interface Builder file.
Are you sure that the receiver is indeed a SettingsController? Try
NSLog(#"receiver's type: %#", NSStringFromClass([foo class]));
just before the call that fails (and of course change "foo" to whatever the receiver's actual name is).