8牲芋、iOS16 swfit 橫屏處理 UIWindowScene.requestGeometryUpdate (2022-9-21)
[Orientation] BUG IN CLIENT OF UIKIT: Setting UIDevice.orientation is not supported. Please use UIWindowScene.requestGeometryUpdate(_:)
//豎屏->橫屏
//iOS 16 及其以上系統(tǒng)運(yùn)行
if #available(iOS 16, *) {
//在視圖控制器中剑梳,獲取窗口場景。
guard let windowScene = view.window?.windowScene else { return }
//windowScene.requestGeometryUpdate(.iOS(interfaceOrientations: .landscapeRight))
//(同上) 請(qǐng)求窗口場景旋轉(zhuǎn)到任何景觀方向谣蠢。
windowScene.requestGeometryUpdate(.iOS(interfaceOrientations: .landscapeRight)) { error in
print("---requestGeometryUpdate 處理拒絕請(qǐng)求 \n\n")
}
//處理橫屏View布局...
}else{
UIView.animate(withDuration: 0.25) {
let value:Double = Double(UIInterfaceOrientation.landscapeRight.rawValue )
UIDevice.current.setValue(value, forKey: "orientation")
//處理豎屏View布局...
}
}
7粟耻、pod 'RealmSwift', '~> 10.15.1' 報(bào)錯(cuò):
[!] The following Swift pods cannot yet be integrated as static libraries: The Swift pod
RealmSwiftdepends upon
Realm, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set
use_modular_headers!globally in your Podfile, or specify
:modular_headers => truefor particular dependencies.
解決方案:
在podfile 中添加 use_frameworks!
然后 pod install 或 pod update
6、編譯報(bào)錯(cuò):CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION‘ to ‘YES‘
error: Entitlements file "cencobuy.entitlements" was modified during the build, which is not supported. You can disable this error by setting 'CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION' to 'YES', however this may cause the built product's code signature or provisioning profile to contain incorrect entitlements. (in target 'cencobuy' from project 'cencobuy')
引用:解決方案:https://blog.csdn.net/qq_17790209/article/details/113900382
5眉踱、安裝證書失敗
報(bào)錯(cuò):Please ensure the provisioning profile is configured for this device. If not, please try to generate
解決方案:
In Xcode, 打開 Window > Devices and Simulators > Select Device > Unpair Device (for all devices) open .mobileprovision again. Good luck!
4挤忙、去除導(dǎo)航欄陰影
if #available(iOS 15.0, *) { //UINavigationBarAppearance屬性從iOS13開始
let navBarAppearance = UINavigationBarAppearance()
// 背景色
navBarAppearance.backgroundColor = UIColor.clear
// 去掉半透明效果
navBarAppearance.backgroundEffect = nil
// 去除導(dǎo)航欄陰影(如果不設(shè)置clear,導(dǎo)航欄底下會(huì)有一條陰影線)
navBarAppearance.shadowColor = UIColor.clear
// 字體顏色
navBarAppearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
self.navigationController?.navigationBar.scrollEdgeAppearance = navBarAppearance
}
3谈喳、AFN的內(nèi)存泄漏問題:不用單例怎么解決AFN的內(nèi)存泄露呢册烈?
解決方案:主動(dòng)去給他釋放
2、上架被禁止:"UIUserInterfaceStyle can’t be 'UIUserInterfaceStyleLight'. It can only be 'Light', 'Dark', or 'Auto
解決方案1:
提示很明顯婿禽,將info.plist文件中這個(gè)屬性設(shè)置為Light就好了赏僧,然后修改成Light大猛,繼續(xù)archive,繼續(xù)上傳淀零。胎署。。
在Info.plist中增加UIUserInterfaceStyle,值為Light,如下
<key>UIUserInterfaceStyle</key>
<string>Light</string>
解決方案2:
if (@available(iOS 13, *)) {//強(qiáng)制light模式
[self.window setOverrideUserInterfaceStyle:UIUserInterfaceStyleLight];
}
1窑滞、iOS開發(fā)-關(guān)于UI界面未能鋪滿全屏的問題
多半是因?yàn)長aunch Screen File未處理好, 默認(rèn)設(shè)置是選擇Launch Screen File為LaunchScreen, 如下圖: