[NSThread sleepForTimeInterval:1.0];
self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
if (![[NSFileManager defaultManager] fileExistsAtPath:[Path path:@"Citys"]]) {
NSFileManager *fileManager = [NSFileManager defaultManager];
[fileManager copyItemAtPath:[[NSBundle mainBundle] pathForResource:@"Citys" ofType:@""] toPath:[Path path:@"Citys"] error:nil];
}
Path : NSObject
+(NSString *)path:(NSString *)fileName{
NSString *path=[NSString stringWithFormat:@"%@/Documents/%@",NSHomeDirectory(),fileName];
return path;
}
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"everLaunched"]) {
}
if ([UIDevice currentDevice].systemVersion.floatValue >= 8.0) {
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil];
[application registerUserNotificationSettings:settings];
[self createLocalNotification];
}else {
[application registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound)];
}