Today I was trying to implement some array manipulation in Swift to find elements with unique property value in an object. Here is the code I was trying to execute.
let values = NSArray(array: forecastLines!) let grps = values.valueForKeyPath("@distinctUnionOfObjects.date_txt")
I was getting hit with following exception.
2015-12-18 09:48:41.466 WeatherWatch[56504:1522512] *** NSForwarding: warning: object 0x7fc191dcc590 of class 'WeatherWatch.OpenWeatherMapData' does not implement methodSignatureForSelector: -- trouble ahead Unrecognized selector -[WeatherWatch.OpenWeatherMapData valueForKeyPath:]
The exception stumped for a bit. After paying little closer attention to this exception, I noticed mention of methodSigntureForSelector. Well this family of methods are implemented in NSObject class. Then I looked at my OpenWeatherMapData and saw that I did not inherit from NSObject. After the class signature was changed to following, the run time errors disappeared and I was able to get distinct collection of key values.
public class OpenWeatherMapData:NSObject{...}
Learn Python: How to format date in Python
Class does not implement methodSignatureForSelector error in Swift
Implement OWA style New message notifier poup using Silverlight
How to plan CCSP Exam preparation
Develop a MongoDB pipeline to transform data into time buckets
Alert and Confirm pop up using BootBox in AngularJS
AngularJS Grouped Bar Chart and Line Chart using D3
How to lock and unlock account in Asp.Net Identity provider
2024 © Byteblocks, ALL Rights Reserved. Privacy Policy | Terms of Use