我需要帮助识别我的错误。有谁知道它为什么会出错?
if (result == NSFileHandlingPanelOKButton) {
NSString *filePath = [[openPanel URLs] objectAtIndex:0];
NSLog(@"%@", filePath);
*CODE WORKS UP TO HERE*
NSString *strTemp = [self extractString:filePath toLookFor:@"//" skipForwardX:2 toStopBefore:@".png"];
NSLog(@"%@",strTemp);
NSString *copyScript = [NSString stringWithFormat:@"%@ /tmp/%@.png", strTemp, myString];
strTemp = [[NSString alloc] init];
NSString *path = @"/Applications/APP.app/Contents/Resources/copy.sh";
NSArray *args = [NSArray arrayWithObjects:copyScript, nil];
[[NSTask launchedTaskWithLaunchPath:path arguments:args] waitUntilExit];
NSString* linkName = @"/tmp/";
NSString* extension = @".png";
NSString* fullPath = [NSString stringWithFormat:@"%@%@%@", linkName, myString, extension];
urlPathOfFile = [NSString stringWithFormat:@"URL/%@%@", myString, extension];
fileURL = [NSURL URLWithString:fullPath];
action = upload;
[self runAction];
这是一个内存错误,因为我有太多字符串吗?
答案 0 :(得分:0)
filePath
指向NSURL
个对象的概率很高,而不是NSString
。