感谢阅读。我解决了这个问题。原因如下:
在info.plist文件中,我修改了行" Localization native development region"到"德国"。之后,应用程序不再在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内启动时工作正常。
我知道这可能就是一切,但你有什么想法会导致这个问题吗?
答案 0 :(得分: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;
}