ラベル Objective-C の投稿を表示しています。 すべての投稿を表示
ラベル Objective-C の投稿を表示しています。 すべての投稿を表示

2013/02/03

this class is not key value coding-compliant for the key.

(English text is available below.)
this class is not key value coding-compliant for the key
なるメッセージで実行時エラーになる。(コンパイルは通った。)
私の場合、どうやら Storyboard に置いたLabelオブジェクトを .h に接続したあと
.h で変数名を変えたのがダメだったらしい。
  1. Storyboard のLabelオブジェクトを右クリックして「Referencing Object」のあやしい箇所を修正
  2. 左のNavigatorから Storyboard を右クリックして「Open As」「Source Code」で開いたStoryboardのソースから変更前の名前を探して修正
でうごいた。
なのでStoryboardになにか変なものがいると起こるエラーみたいよ。


              - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

(I've added English translated text for some traffic from US.)

this class is not key value coding-compliant for the key
I'd got the error on execution while compiling was no problem.
In my case, it was the problem that I had fixed a variable name in ".h" file after connecting "Label" object on Storyboard to the ".h" file.
Below is how to fix.

  1. Right click "Label" object on Storyboard, and fix an old variable name in "Referencing Object" section.
  2. Right click "Storyboard" in Navigator window, select menu "Open As" -> "Source Code", and search and fix an old name in the Storyboard source.

So the error is likely to be due to a Storyboard mismatch.

iOS6でdidUpdateToLocationが使えなくなった件

(English text is available below.)

iOS6から CoreLocation の didUpdateToLocation が使えなくなったらしい。
didUpdateLocations を使えと言われるが
なんか引数がちがう。
- (void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLocation
           fromLocation:(CLLocation *)oldLocation
- (void)locationManager:(CLLocationManager *)manager
     didUpdateLocations:(NSArray *)locations
didUpdateToLocation の newLocation は
[locations lastObject] でとれるらしい。
- (void) locationManager:(CLLocationManager *)manager
      didUpdateLocations:(NSArray *)locations{
    CLLocation *newLocation = [locations lastObject];
}
のようにすると newLocation がとれるんだって。


              - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(I've added English translated text for some traffic from US.)


 "didUpdateToLocation" method has been obsolete from iOS6.
Alternatively "didUpdateLocations" has been available but parameters are different.
- (void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLocation
           fromLocation:(CLLocation *)oldLocation
- (void)locationManager:(CLLocationManager *)manager
     didUpdateLocations:(NSArray *)locations
When you want "newLocation" in "didUpdateToLocation", you can use [locations lastObject] like below.
- (void) locationManager:(CLLocationManager *)manager
      didUpdateLocations:(NSArray *)locations{
    CLLocation *newLocation = [locations lastObject];
}
Related Posts Plugin for WordPress, Blogger...