xcode running error - xcode

I am making an iphone app in xcode and I changed a few things and i got this error:
2012-01-01 10:55:40.295 Dodge Cars free[549:f803] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x68912d0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key RoadImage.'
*** First throw call stack:
(0x13cd052 0x155ed0a 0x13ccf11 0x9c4032 0x935f7b 0x935eeb 0x950d60 0x24391a 0x13cee1a 0x1338821 0x24246e 0x244010 0x2414a 0x24461 0x237c0 0x32743 0x331f8 0x26aa9 0x12b7fa9 0x13a11c5 0x1306022 0x130490a 0x1303db4 0x1303ccb 0x232a7 0x24a9b 0x1fc8 0x1f25 0x1)
terminate called throwing an exception
I don't know exactly what it means but the RoadImage it is referring to is a UIImageView in my .xib file. I have tried to clean the application but that doesn't seem to help. Any ideas?

maybe in your .h file you changed:
IBOutlet UIImage * RoadImage;
to something that fits with the naming convention:
IBOutlet UIImage * roadImage;
but in your xib you are still trying to connect to RoadImage, go look at your connection, I would guess that you have something connected that isn't valid anymore.

I figured out my problem in the xcode project information I didn't realize but I changed my main interface to my .xib file and for whatever reason that caused the problem.

Related

Swift 2, warning: could not load any Objective-C class information from the dyld shared cache

I have found a few questions regarding this issue, yet none of them were helping with my problem. I am trying to save an object to core data using this code (which worked perfectly fine in Xcode 6 and Simulator...):
let fetchRequest = NSFetchRequest(entityName: "Patient")
let fetchedResults : [NSManagedObject]!
do {
fetchedResults = try managedContext.executeFetchRequest(fetchRequest) as! [NSManagedObject]
patienten = fetchedResults
} catch {
print("error")
}
I added the do-try-catch once I started working on this project in the Xcode 7 beta and a physical device.
Now, when I hit the Save button, this piece of code is called, the app freezes and I get the following:
warning: could not load any Objective-C class information from the dyld shared cache. This will significantly reduce the quality of type information available.
Does anybody know where I went wrong?
For anyone coming across this in the future, I just ran into this problem myself and it turned out that I was actually getting a stack overflow from a recursive function.
Apparently calling setValue:forKey: on an NSObject calls the respective set[Key] function, where [Key] is the (capitalized) name you gave to the forKey section.
So, if like me, you have code that looks like the following, it will cause an infinite loop and crash.
func setName(name: String) {
self.setValue(name, forKey: "name")
}
Choose Product > Clean
I had similar issue. I deleted the app from the device. Then "Product->Clean" in the XCode menu. When I ran the app again, the issue got resolved.
Swift 3:
Actually this problem happened often when you have any property in input declared as type NSError and the compiler expect an Error output, so change the input type to Error usually solve this issue.
What helped me in similar problem (xCode 7, Swift 2):
reading this question
Or more quickly without explaining the reason of solution: just comment #objc(className) in your NSManagedObjectSubclass , that was generated from your CoreData Entity (#objc(Patient) - in your case ).
This solution (if issue still appears) does not applicable to xCode 7.1/Swift 2.1, as the way of generating NSManagedObjectSubclasses was changed.
Don't forget about cleaning your project (Product > Clean) and deleting the app from your device/simulator to replace CoreData storage on it.
let fetchRequest = NSFetchRequest(entityName: "Patient")
do {
let fetchedResults = try managedObjectContext!.executeFetchRequest(fetchRequest)
print("\(fetchedResults)")
} catch {
print("error")
}
The above code worked for me.
Maybe the issue maybe with how your core data is managed.
Check if your managedObjectContext is actually getting created.
Check the modelling of your core data

I can't find a 'objectForKey' in 'NSMutableArray' in Xcode6.1.1

I keep getting an error saying,
'NSMutableArray' does not have a member named 'objectForKey'
Please help me I'm just a beginner at Xcode Swift and programming...
objectForKey is an NSDictionary method because an array has no keys.
Try objectAtIndex or myArray[index]
See: http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/

-[NSKeyedUnarchiver initForReadingWithData:]: data is empty; did you forget to send -finishEncoding to the NSKeyedArchiver?

I get this warning only on my first item on a table view once i go into the "drill down" view on a core data app.
anyone else got this warning?
-[NSKeyedUnarchiver initForReadingWithData:]: data is empty; did you forget to send -finishEncoding to the NSKeyedArchiver?
thanks
Xcode 7.2.1, iOS 9.2.1, ARC enabled
Check to see that the NSData object you are using to store data does not get released before it is accessed. You must check this at the place where the data is accessed, not in your view controller or else where.
-[NSKeyedUnarchiver initForReadingWithData:]: data is empty; did you forget to send -finishEncoding to the NSKeyedArchiver?
This warning is raised when the NSData object is empty. The sure way to check if it is or not, is to use [yourDataObject length] and make sure it is not zero.
Hope this helps! Cheers.
once I had met this problem, It's cause by...
NSString *str = #"ss";
NSString *temp = [str substringToIndex:4];
In iOS8.
now xCode8.1 will tell you
* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSCFConstantString substringToIndex:]: Index 4 out of bounds; string length 2'
It seems that you are trying to read from an empty data object.
Maybe you initialize your data as [NSData data] before or your saved data is empty.

[__NSDate length]: unrecognized selector sent to instance

I have a datePicker and I trying send the value but don't working it.
The Error:
-[__NSDate length]: unrecognized selector sent to instance 0x8ee2330
2014-06-30 13:49:42.602 Golf Tipp[2374:60b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDate length]: unrecognized selector sent to instance 0x8ee2330'
**My Code:**
Confirmacion *cuartoView = (Confirmacion *)[segue destinationViewController];
NSDate *date = [self.fecha_hora date];
cuartoView.fecha = date;
You have an object of type NSDate. And somewhere you have code that believes the object is an NSString or maybe NSData (not NSDate), and sends a length message to it.
The usual way to find the problem is either: Stare at your code long and hard. Or: Set an exception breakpoint in Xcode and find where the problem happens, and deduce from that what you did wrong. If you don't know how to set an exception breakpoint in Xcode, feel free to use Google.

How can I tell where my XCode output originates from?

For example, in my console, I have output such as :
2012-11-29 21:25:40.696 Program[31053:707] -[Staff Shifts]: unrecognized selector sent to instance 0x107d6fdd0
2012-11-29 21:25:40.697 Program[31053:707] Exception detected while handling key input.
I was wondering if there's an easy way to find out where this is from?
The debug console can only tell you so much. According to the error, you are trying to access a selector (possibly) within the class Staff that isn't recognized by the instance of that class.
You could, however, use this bit of information to set a breakpoint within that class and step over methods until the exception reoccurs. Then you could set a breakpoint at that method and step into it until you find the problem.
You could also use gdb po at runtime to check for nil/unexpected objects.
The [Staff Shifts] might indicate that you have a class named [Staff Shifts] in your code that is causing the error. An unrecognized selector means that you have the following:
selector: #selector(FunctionName:)
But the function FunctionName: doesn't exist...

Resources