基本的な iPhone アプリケーションを (スタンフォード大学の iTunes CS193p の講義を受けながら) iOS シミュレーターで実行するのに問題があります。
私はしばらくの間(GoogleとSOの両方で)検索してきましたが、これまでのところ解決策を見つけることができません. 似たようなバグがたくさんありますが、解決策はこれを修正していないようです。
Xcode で「実行」をクリックします。コンパイルとビルドに成功し、iOS シミュレーターを起動しますが、アプリをロードすることはありません。上部のステータス バーのみ。黒い画面で。
私は非常に基本的なコードを書いただけで(講義に沿って)、この問題を乗り越えることができません。
さらに混乱させるために、(UIWebView)
これらの講義の前に Web ラッパーを作成しましたが、これは正常に機能します。しかし、コードにはほとんど違いはありません。私が最初から作成した新しいアプリはすべて、同じ黒い画面の問題で失敗します。
シミュレーターのホームボタンを押してアプリを起動すると表示されます。しかし、Xcode は何が起こっているのかを認識していないようです。
Xcode が iOS シミュレーターと対話する機能を失い、それが実行中であると想定しているかのようです (iOS シミュレーターを終了しても)。Xcode を終了しようとすると、タスクを停止するように求められます。その後、ハングします。そのため、強制的に再起動して Xcode から抜け出す必要があります。
私が使用している: OSX 10.8.2 Xcode 4.5.2 iOS シミュレーター 6.0
CalculatorAppDelegate.h
#import <UIKit/UIKit.h>
@interface CalculatorAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
CalculatorAppDelegate.m
#import "CalculatorAppDelegate.h"
@implementation CalculatorAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions (NSDictionary *)launchOptions
{
// Override point for customization after application launch.
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end
CalculatorViewController.h
#import <UIKit/UIKit.h>
@interface CalculatorViewController : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *display;
@end
CalculatorViewController.m
#import "CalculatorViewController.h"
@implementation CalculatorViewController
@synthesize display = _display;
- (IBAction)digitPressed:(UIButton *)sender
{
NSString *digit = [sender currentTitle];
NSLog(@"digit pressed = %@", digit);
}
@end