Cocoa error 260

后端 未结 6 1580
借酒劲吻你
借酒劲吻你 2021-02-05 03:20

I keep getting this error. I\'m uploading via ftp to a server. It works fine and uploads completely while running in the simulator, but when I provision it on my iPhone, it says

6条回答
  •  长情又很酷
    2021-02-05 03:51

    +(DataManager*)getSharedInstance{
    if (!sharedInstance) {
        sharedInstance = [[super allocWithZone:NULL]init];
        [sharedInstance copyDatabaseIntoDocumentsDirectory];
    }
    return sharedInstance;
    

    }

    -(void)copyDatabaseIntoDocumentsDirectory{

    // Set the documents directory path to the documentsDirectory property.
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    self.documentsDirectory = [paths objectAtIndex:0];
    
    // Keep the database filename.
    self.databaseFilename = DATABASE_FILENAME;
    
    // Check if the database file exists in the documents directory.
    destinationPath = [self.documentsDirectory stringByAppendingPathComponent:self.databaseFilename];
    
    if (![[NSFileManager defaultManager] fileExistsAtPath:destinationPath]) {
        // The database file does not exist in the documents directory, so copy it from the main bundle now.
        NSString *sourcePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:self.databaseFilename];
        NSError *error;
        [[NSFileManager defaultManager] copyItemAtPath:sourcePath toPath:destinationPath error:&error];
    
        // Check if any error occurred during copying and display it.
        if (error != nil) {
            NSLog(@"%@", [error localizedDescription]);
        }
    }
    

    }

    Note : error 260 : meaning the file could not be found at the path you specified (once again create DB and then add your project).

提交回复
热议问题