Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //- (void)applicationDidFinishLaunching:(UIApplication *)application
- //{
- // // Override point for customization after app launch
- // [window setRootViewController:viewController];
- // [window makeKeyAndVisible];
- //}
- //
- //
- //
- //
- //@end
- #pragma mark
- #pragma mark
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
- [NSURLCache setSharedURLCache:sharedCache];
- [sharedCache release];
- sharedCache = nil;
- NSArray* keys =
- [[NSBundle mainBundle] URLsForResourcesWithExtension:@"key"
- subdirectory:nil];
- for (NSURL* url in keys) {
- NSString* filename = url.pathComponents.lastObject;
- NSString* name = [filename stringByDeletingPathExtension];
- NSError* error;
- if (![self copyKeyFile:name error:&error]) {
- NSLog(@"%@", error);
- }
- }
- [window setRootViewController:viewController];
- [window makeKeyAndVisible];
- return YES;
- }
- -(BOOL)copyKeyFile:(NSString*)name error:(NSError**)error {
- NSURL* documentsPath =
- [[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory
- inDomains:NSUserDomainMask].firstObject;
- NSString* filePath = [NSString stringWithFormat:@"cprocsp/keys/test.000/%@.key", name];
- NSString* headerDst = [documentsPath.path stringByAppendingPathComponent:filePath];
- NSString* dirPath = [documentsPath.path stringByAppendingPathComponent:@"cprocsp/keys/test.000"];
- if(![[NSFileManager defaultManager] createDirectoryAtPath:dirPath
- withIntermediateDirectories:YES
- attributes:nil
- error:error]) {
- NSLog(@"Error: Create folder failed %@: %@", dirPath, *error);
- return NO;
- }
- NSString* headerSrc =
- [[NSBundle mainBundle] pathForResource:name
- ofType:@"key"];
- [[NSFileManager defaultManager] removeItemAtPath:headerDst
- error:nil];
- return [[NSFileManager defaultManager] copyItemAtPath:headerSrc
- toPath:headerDst
- error:error];
- }
- #pragma mark
- #pragma mark
- - (void)dealloc {
- [viewController release];
- [window release];
- [super dealloc];
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement