Xcode Error: ...This Class Is Not Key Value Coding-Compliant for the Key Ibshadowedlargetitletextattributes

Why do I get the error: Class is not key-value coding compliant for key major even though major is a property of the class?

You haven't specified yet the element that has the major property, try this...

userProfilesArray.filter{$0.major == "Computer Science"}

assuming that your array is an Array of Profile objects

Getting a Key value coding compliant error message

Check your nib to see if you have some connection to outlet called forLatitude. It's not a core location problem, this is an outlet connection problem

Xcode Swift - This class is not key value coding-compliant for the key uri

I suspect you actually mean this:

Check if the entity is empty, if yes insert a new object with default values

class func musicIsEmpty(managedObjectContext: NSManagedObjectContext)-> Bool {

let musicEntity = NSEntityDescription.entityForName("Music", inManagedObjectContext: managedObjectContext)!
let fetchRequest = NSFetchRequest()
fetchRequest.entity = musicEntity
do {
let musicSetResults = try managedObjectContext.executeFetchRequest(fetchRequest) as! [Music]
if musicSetResults.isEmpty
{
let defaultMusicSetOne = NSManagedObject(entity: musicEntity, insertIntoManagedObjectContext: managedObjectContext) as! Music
defaultMusicSetOne.uri = "spotify:track:1puJlKuYGH58SAFgXREUpE"
defaultMusicSetOne.duration = 30.0
defaultMusicSetOne.starttime = 49.0
defaultMusicSetOne.xfade = 10.0
defaultMusicSetOne.voiceover = "1.25s Next Up.mp3"
return true
}
}
catch let error as NSError{
print("Error: \(error.debugDescription)")
}
return false
}

You might consider also to save the managed object context to make the new object persistent.

Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X error?

Your view controller may have the wrong class in your xib.

I downloaded your project.

The error you are getting is

'NSUnknownKeyException', reason: '[<UIViewController 0x3927310> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key string.'

It is caused by the Second view controller in MainWindow.xib having a class of UIViewController instead of SecondView. Changing to the correct class resolves the problem.

By the way, it is bad practice to have names like "string" in Objective-C. It invites a runtime naming collision. Avoid them even in once off practice apps. Naming collisions can be very hard to track down and you don't want to waste the time.

Another possible reason for this error: when copying & pasting elements from one controller into another, Xcode somehow keeps that link to the original controller, even after editing & relinking this element into the new controller.

Another possible reason for this error:

Bad Outlet.

You have either removed or renamed an outlet name in your .h file.

Remove it in .xib or .storyboard file's Connection Inspector.

One more possible reason

(In my case) Extension of UIView with bindable properties and setting values for those bindable properties (i.e. shadow, corner radius etc.) then remove those properties from UIView extension (for some reason) but the following <userDefinedRuntimeAttributes> remained in xml (of foo.storyboard):

<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="shadowColor">
<color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="shadowOpacity">
<real key="value" value="50"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="point" keyPath="shadowOffset">
<point key="value" x="5" y="5"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="shadowRadius">
<real key="value" value="16"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="borderWidthValue">
<real key="value" value="0.0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>

Solution: Right click on foo.storyboard > Open as Source Code > search by keyPath (i.e. shadowRadius) > Delete the </userDefinedRuntimeAttributes> that causing the problem

Xcode Swift - This class is not key value coding-compliant for the key uri

I suspect you actually mean this:

Check if the entity is empty, if yes insert a new object with default values

class func musicIsEmpty(managedObjectContext: NSManagedObjectContext)-> Bool {

let musicEntity = NSEntityDescription.entityForName("Music", inManagedObjectContext: managedObjectContext)!
let fetchRequest = NSFetchRequest()
fetchRequest.entity = musicEntity
do {
let musicSetResults = try managedObjectContext.executeFetchRequest(fetchRequest) as! [Music]
if musicSetResults.isEmpty
{
let defaultMusicSetOne = NSManagedObject(entity: musicEntity, insertIntoManagedObjectContext: managedObjectContext) as! Music
defaultMusicSetOne.uri = "spotify:track:1puJlKuYGH58SAFgXREUpE"
defaultMusicSetOne.duration = 30.0
defaultMusicSetOne.starttime = 49.0
defaultMusicSetOne.xfade = 10.0
defaultMusicSetOne.voiceover = "1.25s Next Up.mp3"
return true
}
}
catch let error as NSError{
print("Error: \(error.debugDescription)")
}
return false
}

You might consider also to save the managed object context to make the new object persistent.

Setting value for title of NSOpenPanel does not work

The title is something from the past when windows in macOS had title bars. To show text or an instruction on top of the NSOpenPanel object, use the message property:

nsOpenPanel.message = "Hello, Choose Files"


Related Topics



Leave a reply



Submit