You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi, @wangmchn , my app crashed when I run it in iOS10 phone, it gets an error that fatal error: unexpectedly found nil while unwrapping an Optional value, this error perhaps caused by func: adjustMenuViewFrame, iOS 10 does not has this class : NSClassFromString("_UINavigationBarBackground")?, I have tried to fix it and it works by below codes:
for subview in (navigationController?.navigationBar.subviews)! {
// add a guard to filter that missing class: _UINavigationBarBackground
guard let _ =NSClassFromString("_UINavigationBarBackground")else{
continue
}
guard !subview.isKindOfClass(NSClassFromString("_UINavigationBarBackground")!) && !subview.isKindOfClass(MenuView.self) && (subview.alpha !=0) && (subview.hidden == false)else{ continue }letmaxX=CGRectGetMaxX(subview.frame)
if maxX < viewWidth /2{letleftWidth= maxX
menuX = menuX > leftWidth ? menuX : leftWidth
}letminX=CGRectGetMinX(subview.frame)
if minX > viewWidth /2{letwidth= viewWidth - minX
rightWidth = rightWidth > width ? rightWidth : width
}}
I don't know whether it will cause other bug, or maybe it not the correct way to avoid the crash.
Environment: Xcode8, Swift2.3, iOS 10
thanks.
The text was updated successfully, but these errors were encountered:
hi, @wangmchn , my app crashed when I run it in iOS10 phone, it gets an error that
fatal error: unexpectedly found nil while unwrapping an Optional value
, this error perhaps caused by func:adjustMenuViewFrame
, iOS 10 does not has this class :NSClassFromString("_UINavigationBarBackground")
?, I have tried to fix it and it works by below codes:I don't know whether it will cause other bug, or maybe it not the correct way to avoid the crash.
Environment: Xcode8, Swift2.3, iOS 10
thanks.
The text was updated successfully, but these errors were encountered: