I have a command (xcodebuild) that if I try in terminal it works very well. When I try to put it on my code:
let xcodeProjectPath = "/Users/xxx/Desktop/Code/xxx.xcworkspace"
let xcodeArchivePath = "/Users/xxx/Desktop/xxx.xcarchive"
let schemeName = "XXX"
let pid = NSProcessInfo.processInfo().processIdentifier
let pipe: NSPipe = NSPipe()
let file: NSFileHandle = pipe.fileHandleForReading
let archiveCommand = "xcodebuild -scheme \(schemeName) -workspace \(xcodeProjectPath) -configuration Release -archivePath \(xcodeArchivePath) archive"
let task = NSTask()
task.launchPath = "/bin/sh"
task.arguments = NSArray(objects: "-l", "/Users/xxx/Desktop/test.sh") as [AnyObject]
task.standardInput = NSPipe()
task.standardOutput = pipe
task.launch()
let data = file.readDataToEndOfFile()
file.closeFile()
let grepOutput = NSString(data: data, encoding: NSUTF8StringEncoding)
println("Returned: \(grepOutput!)")
It doesn't work and return me:
** ARCHIVE FAILED **
The following build commands failed:
DataModelVersionCompile /Users/xxx/Library/Developer/Xcode/DerivedData/XXX-fbrisxgdcevajabbkhkejvwjrxyt/Build/Intermediates/ArchiveIntermediates/XXX/InstallationBuildProductsLocation/Applications/XXX.app/Database.momd Application/Resources/Database/Database.xcdatamodeld
My script.sh is:
#!/bin/sh
xcodebuild -scheme XXX -workspace /Users/xxx/Desktop/Codice/xxx.xcworkspace -configuration Release -archivePath /Users/xxx/Desktop/provaBuild.xcarchive archive
Any idea? :(