According to the docs here: https://www.parse.com/docs/ios_guide#files-progress/iOS
this is the suggested syntax to handle file saving with a completion block and progressBlock.
let str = "Working at Parse is great!"
let data = str.dataUsingEncoding(NSUTF8StringEncoding)
let file = PFFile(name:"resume.txt", data:data)
file.saveInBackgroundWithBlock {
(succeeded: Bool!, error: NSError!) -> Void in
// Handle success or failure here ...
}, progressBlock: {
(percentDone: Int) -> Void in
// Update your progress spinner here. percentDone will be between 0 and 100.
}
However, XCode 6.2 throws this error: Consecutive statements on a line must be separated by ';'
on this line:
}, progressBlock: {
Anyone know how to properly utilize the progressBlock in this scenario?
Edit 1: Here's the sample in Obj C:
NSData *data = [@"Working at Parse is great!" dataUsingEncoding:NSUTF8StringEncoding];
PFFile *file = [PFFile fileWithName:@"resume.txt" data:data];
[file saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
// Handle success or failure here ...
} progressBlock:^(int percentDone) {
// Update your progress spinner here. percentDone will be between 0 and 100.
}];
Edit 2:
Another attempt, different error:
Edit 3: Original code, but with CInt per a comment suggestion