我正在开发 iOS - Cordova 跨平台。
我正在使用以下代码从 Javascript 端获取图像路径 -
NSString *fileName =[command argumentAtIndex:0];
我想使用 Objective-c 从此图像路径中删除图像。
我该怎么办?请帮忙
谢谢
最佳答案
你应该可以这样做:
NSString *fileName = [command argumentAtIndex:0];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@", fileName]];
[fileManager removeItemAtPath:filePath error:NULL];
关于javascript - 如何使用 Objective-C 从 IOS Cordova 中的设备(本地数据库)中删除图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35789509/