error changing root controller from navigation to tab - ios5

I have a project that starts off with a navigation controller that goes to table view controller.
I'm now trying to make a tab controller first, but i'm getting the following error. The error doesn't occur if the tab controller isn't there.
2012-06-26 18:12:31.639 Medicine Tracker[1212:fb03] -[UITabBarController topViewController]: unrecognized selector sent to instance 0x6d64970
2012-06-26 18:12:31.667 Medicine Tracker[1212:fb03] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITabBarController topViewController]: unrecognized selector sent to instance 0x6d64970'
* First throw call stack:
(0x16b4022 0x1845cd6 0x16b5cbd 0x161aed0 0x161acb2 0x3dc7 0x1d386 0x1e274 0x2d183 0x2dc38 0x21634 0x159eef5 0x1688195 0x15ecff2 0x15eb8da 0x15ead84 0x15eac9b 0x1dc65 0x1f626 0x278d 0x26f5)
terminate called throwing an exception

The topViewController method is not a member of UITabBarController. It does have a method called selectedViewController, which might provide the functionality that you need.
UITabBarController Class Reference

Related

Error while running iPhone App Help - __NSCFConstantString error meaning

Could someone please tell me what this means:
2013-02-08 11:19:49.394 xxxxx[10545:907] set selected tab with tag 3
2013-02-08 11:19:49.560 xxxxx[10545:907] did select item
2013-02-08 11:19:49.562 xxxxx[10545:907] tab clicked
2013-02-08 11:19:49.566 xxxxx[10545:907] will show view controller MoreViewController
2013-02-08 11:19:49.567 xxxxx[10545:907] will show other VC
2013-02-08 11:19:49.579 xxxxx[10545:907] -[__NSCFConstantString offImage]: unrecognized selector sent to instance 0x21994c
2013-02-08 11:19:49.580 xxxxx[10545:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString offImage]: unrecognized selector sent to instance 0x21994c'
I just tried modifying some code, however the modifications did not work. So pressed z and undid everything I modified, but now I get this error.
The "unrecognized selector sent to instance" error always means one thing: you are calling a method on an instance that does not support it. In this particular case, you have a line in your code that looks like this:
[someObject offImage];
On this line, someObject is an instance of string, which does not have an offImage method.
This problem could be caused by passing an object of a wrong type to some other method:
[someTarget objectWithOffImage:#"Hello"];
The method could be expecting an object that responds to offImage, but you are passing it a string.
Finally, you may be trying to invoke a method in a category, but you forgot to import the header file for the category.
You are sending the message -offImage to an instance of NSString which does not have a method with that name. Alter your code so that -offImage is sent to the right kind of object

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

PayPal Button unrecognized selector?

I am just writing code for paypal button as below in ViewDidLoad
UIButton *button = [[PayPal getInstance] getPayButtonWithTarget:self andAction:#selector(payWithPayPal) andButtonType:BUTTON_278x43];
and getting the crash as following
2011-11-17 05:41:39.541 MothProject[654:707] -[PayPal getPayButtonWithTarget:andAction:andButtonType:andButtonText:]: unrecognized selector sent to instance 0x2bd2d0
2011-11-17 05:41:39.548 MothProject[654:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PayPal getPayButtonWithTarget:andAction:andButtonType:andButtonText:]: unrecognized selector sent to instance 0x2bd2d0'
*** First throw call stack:
(0x328d78bf 0x367411e5 0x328daacb 0x328d9945 0x32834680 0x8f9b 0x311837ff 0x3118fc39 0x3118faa9 0x3118f98f 0x3118f15b 0x3118ef53 0x31183673 0x31183349 0x77ad 0x311fd565 0x31275ce7 0x37a6e943 0x328aba63 0x328ab6c9 0x328aa29f 0x3282d4dd 0x3282d3a5 0x37f6efed 0x31178743 0x2831 0x27c8)
terminate called throwing an exceptionProgram received signal: “SIGABRT”.
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Can't find dlopen function, so it is not possible to load shared libraries.)
I have used implemented all required delegate methods in self, and also used Delegate too,
What is issue, does anyone has idea about it?
I think you need to initialize the instance of PayPal first, using the method
-initializeWithAppID:forEnvironment:

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

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