0

読んでくれてありがとう。問題を解決しました。その理由は次のとおりです。

info.plist ファイルで、「ローカライゼーション ネイティブ開発地域」の行を「ドイツ」に変更しました。その後、アプリは iPhone ではなくシミュレーターで実行されました。「en」にリセットした後、iPhoneデバイスで再び機能しました。

この特定のケースで、iPhone で動作しない理由を知っている人はいますか?

私は本当に奇妙な問題を抱えています。シミュレーターで iPhone アプリを実行できますが、iPhone デバイスでは実行できません。デバイスで実行すると、次の行でキャッシュされます

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); <-- crashes here
    }
}

私の AppDelegate.m ファイルでは、各メソッドに NSLog を配置しました。

#import "AppDelegate.h"
#import <CoreLocation/CoreLocation.h>

@implementation AppDelegate

@synthesize window = _window;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    NSLog(@"didFinishLaunchingWithOptions");
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
    NSLog(@"applicationWillResignActive");
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    NSLog(@"applicationDidEnterBackground");
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    NSLog(@"applicationWillEnterForeground");
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    NSLog(@"applicationDidBecomeActive");

    if( ![[Logic si] network_is_available] ) {
        [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"AlertView_error_title", @"") message:NSLocalizedString(@"No_Internet_connection_available",@"") delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil] show];
    }

    if( ![CLLocationManager locationServicesEnabled] ) {
        NSLog(@"not locationServicesEnabled");
        [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"AlertView_error_title", @"") message:NSLocalizedString(@"No_location_management_available",@"") delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil] show];
    } else {
        NSLog(@"locationServicesEnabled");
    }
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    NSLog(@"applicationWillTerminate");
}

@end

アプリを実行すると、コンソールに何も出力されず、すぐにクラッシュします。私がプログラムした他のアプリは、iPhone の xcode 内から起動すると正常に動作します。

これがすべてである可能性があることはわかっていますが、この問題を引き起こす可能性のあるアイデアはありますか?

4

1 に答える 1

0

には何もありませんdidFinishLaunchingWithOptions:。これは、ウィンドウを作成する必要がある場所です。新しいプロジェクト (Master-Detail など) を新しく開始し、このデリゲートでウィンドウがどのように作成されるかを確認します。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];    
    DashboardViewController * dashboard = [[DashboardViewController alloc] init];
    self.navigationController = [[UINavigationController alloc] initWithRootViewController:dashboard];       
    self.window.rootViewController = self.navigationController;    

    [self.window makeKeyAndVisible];

    return YES;
}
于 2012-04-29T17:31:47.570 に答える