错误: - [NSURL rangeOfString:]:无法识别的选择器发送到实例0x6180000a0de0

时间:2014-09-19 12:42:32

标签: objective-c xcode cocoa

我需要帮助识别我的错误。有谁知道它为什么会出错?

        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];

这是一个内存错误,因为我有太多字符串吗?

1 个答案:

答案 0 :(得分:0)

filePath指向NSURL个对象的概率很高,而不是NSString