Webで解決策が出てこなかった件
AppDelegateに変数を定義し、各クラスで#import "AppDelegate.h"を実施しているものの、AppDelegateはundeclaredになりerrorになった。In detail,
AppDelegate * appDelegate = [[UIApplication sharedApplication] delegate];
ここでエラーが出る。
二時間ほど試行錯誤した結果、原因が判明。cocos2dを使っているせいかは不明だけど、よくよくソースを読むとAppDelegateの中でAppDelegateはimplementされていない。
@interface AppController : NSObject
{
look!
Therefore, 以下に書き換えたらエラー解消。
AppController * appDelegate = [[UIApplication sharedApplication] delegate];
教訓。
- importするソースくらいはちゃんと目を通そう
- Web上の情報は常に完全ではない