Error while running iPhone App Help - __NSCFConstantString error meaning - iphone

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

Related

Implementing countbyenumeratingwithstate for custom UICollectionviewCell

I am building an app with a CollectionView filled with custom CollectionViewCell.
I added a button "select all/deselect all" which is obviously supposed to affect all the cell in my collectionView. To do this I intended to use a for-loop like this:
for(customCollectionViewCell* cell in self.collectionView){
// some code
}
However i first get a warning saying:
Collection expression type "UICollectionView *" many not correspond to "countByEnumeratingWithStage:objects:count"
And when I compile the program and click on the button, the app crash with the following error message:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UICollectionView countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x7973e00'
Does anyone have an idea on how to solve this?
Many thanks for your help!
Don't iterate the collection view itself, but rather the array of cells it returns by calling the visibleCells method on it.

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.

error changing root controller from navigation to tab

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

Changing Core Data Items crashes App

I am running into another problem with my Iphone App which I just can't solve myself.
I implemented a kind of organizer functionality in my latest app.
There one can create appointments which are displayed in a tableview and persisted in a CoreDataStore. I use 4 classes:
an overview where appointments are displayed
a view with textfields to put in Values for place and name of appointment (create/edit view)
a view with DatePicker to define start- and enddate
a controller which handles creation and deletion of items using this methods:
The code:
-(void)createAppointmentObjectWithDate:(NSDate *)
appointmentDate name:(NSString *)appointmentName
description:(NSString *)appointmentDescription
eDate:(NSDate *)appointmentEndDate
{
NSManagedObjectContext *managedObjectContext = [[CoreDataManager sharedManager] managedObjectContext];
AppointmentObject *newAppointmentObject = [NSEntityDescription insertNewObjectForEntityForName:AppointmentObjectEntityName
inManagedObjectContext:managedObjectContext];
newAppointmentObject.appointmentName = appointmentName;
newAppointmentObject.appointmentDescription = appointmentDescription;
newAppointmentObject.appointmentDate = [appointmentDate earlierDate:appointmentEndDate];
newAppointmentObject.appointmentEndDate = [appointmentEndDate laterDate:appointmentDate];
}
-(void)deleteAppointmentObject:(AppointmentObject *)appointmentObject triggeredByUser:(BOOL)byUser{
NSManagedObjectContext *managedObjectContext = [[CoreDataManager sharedManager] managedObjectContext];
[managedObjectContext deleteObject:appointmentObject];
}
But all kind of crazy stuff is happening which makes my app crash with "SICBART" message:
2010-10-13 17:35:04.630 didacta[109:307] Serious application error. Exception was caught during Core Data change processing.
This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification.
-[CALayer controllerWillChangeContent:]: unrecognized selector sent to instance 0x19f150 with userInfo (null)
2010-10-13 17:35:05.118 didacta[109:307] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CALayer controllerWillChangeContent:]: unrecognized selector sent to instance 0x19f150'
errors appear while doing this:
creating new Appointment and pressing "Done" (should trigger creation and pop overview)
changing appointments and pressing "Done" (should send changes and pop overview)
tapping on an appointment in overview ( should pop create/edit view and hand over values)
deleting an item
sometimes I can even delete an appointment but then the order of the items in the tableview is somehow gotten twisted so the index of the tableview isn't pointing to the index of the appointment anymore.
Right.
-[CALayer controllerWillChangeContent:]: unrecognized selector sent to instance 0x19f150 with userInfo (null)
That's your error. You have an NSFetchedResultsController whose delegate is a CALayer. This sounds like the original delegate was deallocated and a CALayer was allocated using the same region of memory. The fix is to find the offending -dealloc and add something like self.myFetchedResultsController.delegate = nil; self.myFetchedResultsController = nil; assuming you're using properties.
You can sometimes help debugging things like this by enabling zombies (go to Project → Edit Current Executable or so, select Environment, add the NSZombieEnabled environment variable, and set its value to "YES" or so; uncheck the checkbox when you've finished debugging). Zombies cause an exception when a message is sent to a deallocated object. (Zombies are not deallocated by default, so your application will effectively leak; remember to uncheck the checkbox!).
"unrecognized selector" makes it sound like maybe your data model doesn't contain some of the Entity attributes that you're trying to use. For example, maybe you're trying to set an attribute of the object that doesn't exist.
Try creating a breakpoint at newAppointmentObject.appointmentName = appointmentName; and step through it to see at what point the error occurs.

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