MessagesExtension failed with error code -15. What is it?

When I test my MessagesExtension ,this error come up


fisrt i add code in MessagesViewController like:

override func viewDidLoad() {

super.viewDidLoad()

let stickerView = MSStickerBrowserView(frame: self.view.frame, stickerSize: MSStickerSize.large)

stickerView.dataSource = self

self.view.addSubview(stickerView)

}


then add MSStickerBrowserViewDataSource delegate methods:


func numberOfStickers(in stickerBrowserView: MSStickerBrowserView) -> Int {

return 1

}


func stickerBrowserView(_ stickerBrowserView: MSStickerBrowserView, stickerAt index: Int) -> MSSticker {

if let imageURL = URL(string: Bundle.main().pathForResource("3", ofType: "png")!) {

do {

let sticker = try MSSticker(contentsOfFileURL: imageURL, localizedDescription: "image") as MSSticker

let _ = sticker.imageFileURL

return sticker

} catch _ {

print("error")

}

}

return try! MSSticker(contentsOfFileURL: URL(string: "http://p0.meituan.net/320.0.a/deal/__41839401__1277258.jpg")!, localizedDescription: "baidu")

}


when i debug step-to-step , all my code is fine ,but when my code execute finished ,error like this:

2016-06-18 17:32:56.689196 MessagesExtension[5546:392191]

[MessagesExtension] ImageIO: IIOImageSource:356: CFURLCreateDataAndPropertiesFromResource failed with error code -15.

libc++abi.dylib: terminating with uncaught exception of type NSException


what is error code -15 ?

Answered by in 147838022

init(contentsOfFileURL: URL, localizedDescription: String) requires a file: URL. Passing an http: URL as in your example is a mistake.

Accepted Answer

init(contentsOfFileURL: URL, localizedDescription: String) requires a file: URL. Passing an http: URL as in your example is a mistake.

MessagesExtension failed with error code -15. What is it?
 
 
Q