シミュレーターに奇妙なことがあり、誰かが私を助けてくれることを望んでいます。以下のコードは私のAppDelegateにあります。実行しているデバイスに応じて、ストーリーボードが異なります。デバイス検出コードは正常に機能しているようですが、シミュレーターのハードウェア->デバイスを目的の場所に維持するのに問題があります。
- プロジェクト設定は「ユニバーサル」で、シミュレーターはiPhoneに設定されています。シミュレーターはそれ自体をiPhoneシミュレーターに変更し、iPhoneとして実行されます。
- iPadへのプロジェクト設定、iPadへのシミュレーター、iPadとして実行されます。プロジェクトをユニバーサルに戻し、シミュレーターをiPhoneに戻すと、シミュレーターはそれ自体をiPadにリセットし、コードをiPadとして実行します。
- プロジェクトの設定をiPhoneに設定し、シミュレータをiPadに残します。iPadでiPhoneアプリとして動作しますか?
....そして複数の異なるバリエーション。Macとxcodeを複数回再起動しようとしましたが、効果はありませんでした。シミュレーターをリセットして、xcodeではなくシミュレーターでプロジェクトアイコンを実行すると、シミュレーターはハードウェアモードのままになります。何か考えはありますか?
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// testing for iPad detection
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
// setting storyboard name
[[Data sharedData] setStoryboardName:@"MainStoryboardPad"];
// going to the 4" screen story board and settng it as the root controller
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboardPad" bundle:nil];
UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"Intro Screen"];
// making that tab controller the root controller
self.window.rootViewController = viewController;
[self.window makeKeyAndVisible];
return YES;
}
else
{
// detecting screen size
if (([UIScreen mainScreen].scale == 2) && ([[UIScreen mainScreen] bounds].size.height == 568))
{
// setting storyboard name
[[Data sharedData] setStoryboardName:@"MainStoryboard40"];
// going to the 4" screen story board and settng it as the root controller
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard40" bundle:nil];
UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"Intro Screen"];
// making that tab controller the root controller
self.window.rootViewController = viewController;
[self.window makeKeyAndVisible];
return YES;
}
else
{
// setting storyboard name
[[Data sharedData] setStoryboardName:@"MainStoryboard35"];
// going to the 3.5" screen story board and settng it as the root controller
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard35" bundle:nil];
UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"Intro Screen"];
// making that tab controller the root controller
self.window.rootViewController = viewController;
[self.window makeKeyAndVisible];
return YES;
}
}
}