[英]Why does my Xcode Swift app crash when I make a call to webView.load when I use a Development build?
[英]why does my app crash when I call for objectForInfoDictionaryKey: CFBundleShortVersionString
我正在嘗試使用以下方式獲取我的應用程序的版本號:
NSString * version = [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleShortVersionString"];
但它因以下錯誤而崩潰:
[NSString stringWithUTF8String:]: NULL cString
我究竟做錯了什么?
檢查您的info.plist,以確保設置了短版本(CFBundleShortVersionString)或(捆綁版本字符串,短)。
您的代碼很好。 但您也可以這樣稱呼:
NSString * version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.