ios - I'm getting an "Extra argument" error trying to use the coordinateWritingItemAtURL() method of NSFileCoordinator -
the error is: argument 'writingitematurl' in call
i'm developing in swift ios
i'm using xcode 6.1.1 on yosemite
i've tried deleting deriveddata , restarting xcode , has not helped.
here playground code illustrate issue:
let movingoption = nsfilecoordinatorwritingoptions.formoving let replacingoption = nsfilecoordinatorwritingoptions.forreplacing var testurl1 = nsurl(fileurlwithpath: "file1") var testurl2 = nsurl(fileurlwithpath: "file2") var error1: nserrorpointer? var error2: nserrorpointer? let fc = nsfilecoordinator(filepresenter: nil) var result = false fc.coordinatewritingitematurl(testurl1, options: movingoption, writingitematurl: testurl2, options: replacingoption, error: &error1, byaccessor: { (newurl1: nsurl, newurl2: nsurl) in let fm = nsfilemanager.defaultmanager() result = fm.moveitematurl(newurl1, tourl: newurl2, error: error2) if !result { println("debug: failed move file \(moveerror?.localizeddescription)") } })
replace last line this:
fc.coordinatewritingitematurl(testurl1, options: movingoption, writingitematurl: testurl2, options: replacingoption, error: &error1) { (newurl1: nsurl, newurl2: nsurl) -> void in let fm = nsfilemanager.defaultmanager() result = fm.moveitematurl(newurl1, tourl: newurl2, error: error2) if !result { println("debug: failed move file \(moveerror?.localizeddescription)") } }
Comments
Post a Comment