0

At Obj-C we were reading a file and converting its NSString content to NSURL to get AVAsset which was saved as absoluteString beforehand.

audioAssetURL  = [NSURL URLWithString:[readNSString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

audioAsset      = [AVAsset assetWithURL: audioAssetURL];

But In Swift once again saved NSURL as absoluteString can not be used as NSURL and creates error.

let urlString: NSString = readNSString.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)! 

let url = NSURL(fileURLWithPath: urlString as String)

audioAsset = AVAsset(URL: url )as AVAsset

The error message we are getting is that "Error: this application, or a library it uses, has passed an invalid numeric value (NaN, or not-a-number) to CoreGraphics API and this value is being ignored.Please fix this problem."

Hope
  • 2,096
  • 3
  • 23
  • 40
  • It looks that somewhere in your code you are dividing by zero. You can try to set a symbolic breakpoint on `CGPostError` for easier debugging. – Superian007 Oct 30 '15 at 10:10
  • See this http://stackoverflow.com/questions/19187344/how-to-detect-where-nan-is-passing-to-coregraphics-api-on-mac-os-x-10-9 – t4nhpt Oct 30 '15 at 10:56
  • When audioAsset = AVAsset(URL: url ) as AVAsset has been erased we are not getting error message. – Hope Oct 30 '15 at 11:37
  • @Hope this cast as AVAsset makes no sense also – Leo Dabus Oct 30 '15 at 14:20
  • Creating urlString as NSString to later cast it back to String makes no sense either – Leo Dabus Oct 30 '15 at 14:21
  • _url_ was kept in a file as **NSSTRING** so to recreate audioAsset when application reopened we got to convert it. At Obj-C it was working without problem as I wrote in my question. – Hope Oct 30 '15 at 15:19

0 Answers0