我在使用 stringWithFormat 创建 NSString 时得到 EXC_BAD_ACCESS

问题描述

堆栈跟踪:

0   libobjc.A.dylib                 0x00007fff2021a26e objc_opt_respondsToSelector + 27
1   com.apple.CoreFoundation        0x00007fff20405674 __CFStringAppendFormatCore + 9123
2   com.apple.CoreFoundation        0x00007fff20534412 _CFStringCreateWithFormatAndArgumentsReturningMetadata + 145
3   com.apple.CoreFoundation        0x00007fff204032cb _CFStringCreateWithFormatAndArgumentsAux2 + 20
4   com.apple.Foundation            0x00007fff210d1eef +[NSString stringWithFormat:] + 153

错误代码:

NSString* GetPlistPath(){
    return [[NSString stringWithFormat:@"%@/%@/%@",UserLibrary,PREFERENCE_PLIST_DIR_NAME,PREFERENCE_PLIST_NAME] stringByExpandingTildeInPath];
}

其中 UserLibraryNSString*PREFERENCE_PLIST_DIR_NAMEPREFERENCE_PLIST_NAME 是 NSString* const

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)