error: synthesized property 'foobar' must either be named the same as a compatible ivar or must explicitly name an ivar

いま実機でないと重要な機能が試せないアプリを作っていて、それ以外の機能を作るのでシミュレータでいいかと思ってSDKを切り替えたらこういうエラーが出るようになった。

error: synthesized property 'foobar' must either be named the same as a compatible ivar or must explicitly name an ivar

要するに

@interface BazQuux {
}
@property (nonatomic, retain) FooBarType *foobar;

iPhone実機用のSDKだとビルドできるけど、シミュレータ用のSDKでは

@interface BazQuux {
    FooBarType *foobar;
}
@property (nonatomic, retain) FooBarType *foobar;

と書かなければ行けないということ。@synthesize foobar;の下でエラーメッセージがでるので当惑した。

error: synthesized property 'foobar' must either be named the same as a compatible ivar or must explicitly name an ivar

@synthesizeされるプロパティ'foobar'は、代入互換性のあるivarと同じ名前を付けられているか、または明示的にivarをつける必要がある。



なお、仕様上は一つ目のコードで動くはずで、これはシミュレータ用SDKのバグである、という主張が下のページに書いてあった。
iPhone Simulator: build errors when using synthesized instance variables - Stack Overflow

PySpaに持っていくものリスト

危うく財布に現金のない状態で行く所だったのでメモ

ないと困るもの

あったほうがいい?もの

  • ヘッドホン
  • 文房具
  • マグカップ
  • サンバイザー?
  • NDS?(平面的彼女受け取りのため)
  • そろそろ寒いのでジャージ?

flipするアニメーション

[UIView setAnimationDuration:1]の単位をミリ秒だと勘違いして1000って入れていたせいでアニメーションがうまく設定されていないように見えて(実は超スロー)はまった。

	[UIView beginAnimations:nil context:NULL];
	[UIView setAnimationDuration:1];
	[UIView setAnimationTransition:([self.optionView superview] ?
	UIViewAnimationTransitionFlipFromLeft : UIViewAnimationTransitionFlipFromRight)
	forView:self.view cache:YES];
	if ([self.optionView superview]){
		[self.optionView removeFromSuperview];
		[self.view addSubview:self.mainView];
	}else{
		[self.mainView removeFromSuperview];
		[self.view addSubview:self.optionView];
	}
	
	[UIView commitAnimations];