EXC_BAD_ACCESS on NSLog with no string formatting

后端 未结 4 1902
梦如初夏
梦如初夏 2021-02-19 17:56

I\'m getting an EXC_BAD_ACCESS (or a malloc error) on the following line of code:

NSLog(@\"Points:\");  

Which makes zero sense to me, as it

4条回答
  •  Happy的楠姐
    2021-02-19 18:38

    Old question but in Swift you'll get this issue if you are logging an encoded URL which contains '%' - For example:

    NSLog("My long Encoded URL: \(myLongUrlVar)")
    

    Instead, it will work with params:

    NSLog("My long Encoded URL: %@", myLongUrlVar)
    

提交回复
热议问题