I have an iOS app which builds and runs fine in Xcode 8 but after i updated to Xcode 9 the app throws this error at run time:
*** Terminating app due to uncaught exception ... layer = >. Do not add subviews directly to the visual effect view itself, instead add them to the -contentView.'
*** First throw call stack:
(
0 CoreFoundation 0x00000001114e81cb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000110e46f41 objc_exception_throw + 48
2 CoreFoundation 0x00000001114ed362 +[NSException raise:format:arguments:] + 98
...more stack data here...
I'm very new to iOS development and wondering if anyone has seen this recently?
EDIT (Snippet from comment):
fileprivate var _content = UIView()
internal class FrameView : UIVisualEffectView {
internal var content: UIView {
get { return _content }
set {
_content.removeFromSuperview()
addSubview(_content)
}
}
}
EDIT 2 (SOLUTION thanks to @Brandon):
fileprivate var _content = UIView()
internal class FrameView : UIVisualEffectView {
internal var content: UIView {
get { return _content }
set {
_content.removeFromSuperview()
contentView.addSubview(_content)
}
}
}