2014年5月7日水曜日

実行直後に「Unable to simultaneously satisfy constraints.」のエラーが発生

「Add missing constraints」を使ってconstraintsを自動的に生成した場合に、
起動直後に即死するケースが発生。おいおい。 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    
    self.window.rootViewController = self.viewController;    //ここで落ちる
    [self.window makeKeyAndVisible];
    return YES;
}

でもご丁寧にエラーログに対処法が表示されている。

    Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want.
    Try this:
    (1) look at each constraint and try to figure out which you don't expect;
    (2) find the code that added the unwanted constraint or constraints and fix it.
        (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand,
        refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)

・・・不正なconstraintsが設定されているから直してね!みたいな感じか。
生成したのお前だろ。

今回の場合、iPhone5用の画面サイズで生成したconstraintsがiPhone4で実機実行した際に整合性がとれなくなったらしい。
ので縦幅に関するconstraintsを手動で削除・作りなおした。

0 件のコメント:

コメントを投稿