NSData.writeToURL 不适用于 iPhone

NSData.writeToURL does not work at iPhone

我在 iPhone 5s 上测试我的应用程序,在这个应用程序中我使用 NSData.writeToURL(destinationUrl, atomically: true) 保存音频文件,但是这条线不起作用。

如何生成 destinationUrl:

let documentsUrl =  NSURL(fileURLWithPath: NSBundle.mainBundle().resourcePath!)

let fileName = remoteFileUrl.lastPathComponent

let destinationUrl = documentsUrl.URLByAppendingPathComponent(fileName)

在 iOS 模拟器中测试时 - 一切正常

我该如何解决?

您不得在运行时向应用程序包中写入任何内容。
这将破坏应用程序的代码签名。