使用此代码在(pdf文件)中单击打开后:
-(BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
if (url != nil && [url isFileURL]) {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSFileManager *filemgr;
NSError *erf;
filemgr = [NSFileManager defaultManager];
if ([filemgr copyItemAtPath:[NSString stringWithFormat:@"%@", url] toPath:documentsDirectory error: &erf] == YES)
NSLog (@"Copy successful");
else
NSLog (@"Copy failed%@dest: %@", erf, url);
}
return YES;
}
我想将文件复制到我的应用程序,但我有这个错误:
错误域 = NSCocoaErrorDomain 代码 = 260 “操作无法完成。(可可错误 260。)” UserInfo = 0x200826c0 {NSFilePath = file://localhost/private/var/mobile/Applications/ * .pdf,NSUnderlyingError = 0x20082510 “操作无法完成。没有这样的文件或目录”} 什么?