gpt4 book ai didi

ios - iPhone 应用程序在模拟器中启动得非常好,但在 iphone 上什么也不做

转载 作者:行者123 更新时间:2023-12-05 01:35:08 24 4
gpt4 key购买 nike

谢谢阅读。我解决了这个问题。原因如下:

在 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 中启动时,我编写的其他应用程序运行良好。

我知道这可能是一切,但你有什么想法可能导致这个问题吗?

最佳答案

您在 didFinishLaunchingWithOptions: 中一无所有.这是您需要创建窗口的地方。开始一个全新的项目,例如 Master-Detail,并查看如何在此委托(delegate)中创建窗口。

例子

- (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;
}

关于ios - iPhone 应用程序在模拟器中启动得非常好,但在 iphone 上什么也不做,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10374182/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com