Multiple commands produce 'xxx/Info.plist'
原因:項目中存在重復命名的info.plist文件
方案:
- xcworkspace項目: Xcode左上角菜單欄 File –> Workspace Settings –> Build System – >Legacy Build System
- xcodeproj項目:Xcode左上角菜單欄 –> File –> Project Settings –> Build System –> Legacy Build System
library not found for -l”stdc++.6.0.9
原因:Xcode10去除了C++6.0.9的支持
方案:
- TARGETS–Build Phases–Link Binary With Libraries涵但,刪除6.0.9依賴所灸,需要的話對應添加libc++.tdb垦垂、libstdc++.tdb
- TARGETS–Build Settings–Other Linker Flags,刪除 -l”stdc++.6.0.9”
- 如果是第三庫引用了C++6.0.9庫具练,那就只能聯系服務方修改了
WebView播放視頻返回后狀態(tài)欄不見了
原因:視頻播放完成主window成為KeyWindow的時候仍隱藏著UIStatusBar
方案:
- (void)videoPlayerFinishedToShowStatusBar {
if (@available(iOS 12.0, *)) {
[[NSNotificationCenter defaultCenter] addObserverForName:UIWindowDidBecomeKeyNotification
object:self.window
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification * _Nonnull note) {
[[UIApplication sharedApplication] setStatusBarHidden:NO
withAnimation:UIStatusBarAnimationNone];
}];
}
}
wifi獲取SSID(wifi名稱)失敗
原因:需要加權限
方案:
到開發(fā)者界面 在App IDs對應的bundleID中勾選Access WiFi Infomation
然后在Xcode的Capabilities中帝嗡,激活Access WiFi Infomation項它呀。
statusBar結構變化導致原來通過狀態(tài)欄獲取網絡連接信息代碼crash
方案:
+ (NSString *)getIphoneXNetWorkStates {
UIApplication *app = [UIApplication sharedApplication];
id statusBar = [[app valueForKeyPath:@"statusBar"] valueForKeyPath:@"statusBar"];
id one = [statusBar valueForKeyPath:@"regions"];
id two = [one valueForKeyPath:@"trailing"];
NSArray *three = [two valueForKeyPath:@"displayItems"];
NSString *state = @"無網絡";
for (UIView *view in three) {
//alert: iOS12.0 情況下identifier的變成了類"_UIStatusBarIdentifier"而不是NSString,所以會在調用“isEqualToString”方法時發(fā)生crash繁莹,
//修改前
// NSString *identifier = [view valueForKeyPath:@"identifier"];
//修改后
NSString *identifier = [[view valueForKeyPath:@"identifier"] description];
if ([identifier isEqualToString:@"_UIStatusBarWifiItem.signalStrengthDisplayIdentifier"]) {
id item = [view valueForKeyPath:@"_item"];
//alert: 這個問題和上邊一樣itemId是_UIStatusBarIdentifier 類型,不是string
NSString *itemId = [[item valueForKeyPath:@"identifier"] description];
if ([itemId isEqualToString:@"_UIStatusBarWifiItem"]) {
state = @"WIFI";
}
state = @"不確定";
} else if ([identifier isEqualToString:@"_UIStatusBarCellularItem.typeDisplayIdentifier"]) {
UIView *statusBarStringView = [view valueForKeyPath:@"_view"];
// 4G/3G/E
state = [statusBarStringView valueForKeyPath:@"text"];
}
}
return state;
}
另附上Xcode10缺少libstdc++解決方法:
壓縮包
文件夾1的文件放的位置: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/
文件夾2的文件放的位置:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/
文件夾3的文件放的位置:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/
文件夾4的文件放的位置:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/
升級Xcode后xib報錯 Failed to find or create execution context for description ...
方案:
重啟
不想重啟就試試在終端執(zhí)行下面命令
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
# 將你xcode中Developer文件夾位置放進來
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
xcrun simctl erase all