Post

Replies

Boosts

Views

Activity

Reply to iOS 15 SwiftUI App crashes SOMETIMES on SOME devices
I have confirmed that is also is a problem on iOS 14, but I can not edit this post, so just posting updates and reproducible code here: import SwiftUI struct ContentView: View {     var body: some View {         NavigationView {             VStack {                 NavigationLink(destination: SecondView()) {                     Text("Click Me to go to second view (MAY FREEZE)")                 }.padding()                 NavigationLink(destination: ThirdView()) {                     Text("Go to third view first (Multi-Layer)")                 }.padding()                              }         }     } } struct SecondView: View {          @State var downloading = false     @State var message = "Please Wait"          var body: some View {         LoadingView(isShowing: $downloading, message: $message) {             VStack {                 Spacer()                 HStack{                     Spacer()                     Text("This is a second view.").padding()                     Spacer()                 }                 Spacer()             }         }                  .onAppear(perform: {             downloading = true             let twoSecondsFromNow = DispatchTime.now() + 2.0             DispatchQueue.main.asyncAfter(deadline: twoSecondsFromNow) {                 downloading = false             }         })              } } struct ThirdView: View {     var body: some View {         NavigationLink(destination: SecondView()) {             Text("Click Me to go to second view (NO FREEZE)")         }     } } struct LoadingView<Content>: View where Content: View {          @Binding var isShowing: Bool     @Binding var message: String     var content: () -> Content          var body: some View {         GeometryReader { geometry in             ZStack(alignment: .center) {                                  self.content()                     .disabled(self.isShowing)                     .blur(radius: self.isShowing ? 3 : 0)                                  VStack {                     Text(self.message).multilineTextAlignment(.center)                     ProgressView()                 }                 .frame(width: geometry.size.width / 2,                        height: geometry.size.height / 5)                 .background(Color.secondary.colorInvert())                 .foregroundColor(Color.primary)                 .cornerRadius(20)                 .opacity(self.isShowing ? 1 : 0)                              }         }     } } struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView()     } }
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’21
Reply to iOS 15 SwiftUI App crashes SOMETIMES on SOME devices
I have found the lines of offending code: struct LoadingViewMainDownloading<Content>: View where Content: View {     @Binding var isShowing: Bool     @Binding var message: String     var content: () -> Content     var body: some View {         GeometryReader { geometry in             ZStack(alignment: .center) {                 self.content()                     .disabled(self.isShowing)                     .blur(radius: self.isShowing ? 3 : 0)                 VStack {                     Text(self.message).multilineTextAlignment(.center)                     ActivityIndicator(isAnimating: .constant(true), style: .large)                 }                 .frame(width: geometry.size.width / 2,                        height: geometry.size.height / 5)                 .background(Color.secondary.colorInvert())                 .foregroundColor(Color.primary)                 .cornerRadius(20)                 .opacity(self.isShowing ? 1 : 0)             }         }     } } Removing the GeometryReader section does not help. I am using this in a view where it is wrapped around everything in the view and displays an activity indicator when triggered. This works completely fine when built with ios14 binaries, but when built on iOS 15, it causes the freezing issue on certain devices.
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’21
Reply to iOS 15 SwiftUI App crashes SOMETIMES on SOME devices
Here is another TestFlight Crash report, same user: Thread 0#0 (null) in _getNSValueBytes () #1 (null) in -[NSValue(NSValueUIGeometryExtensions) UIEdgeInsetsValue] () #2 (null) in -[UIApplicationSceneSettings safeAreaInsetsPortrait] () #3 (null) in -[UIWindowScene _safeAreaInsetsForInterfaceOrientation:] () #4 (null) in -[UIWindow _sceneSafeAreaInsetsIncludingStatusBar:] () #5 (null) in -[UIScrollView _baseInsetsForAccessoryOnEdge:hasCustomClientInsets:accessorySize:additionalInsetFromEdge:] () #6 (null) in -[UIScrollView _effectiveHorizontalScrollIndicatorInsets] () #7 (null) in -[UIScrollView _layoutHorizontalScrollIndicatorWithBounds:effectiveInset:contentOffset:fraction:additionalInset:cornerAdjust:showing:recalcSize:verticalIndicatorFrame:] () #8 (null) in -[UIScrollView _adjustScrollerIndicators:alwaysShowingThem:] () #9 (null) in -[UIScrollView _updateForChangedScrollIndicatorRelatedInsets] () #10 (null) in _UIScrollViewAdjustForOverlayInsetsChangeIfNecessary () #11 (null) in -[UIScrollView setSafeAreaInsets:] () #12 (null) in -[UIView _eagerlyUpdateSafeAreaInsetsToDescendant:] () #13 (null) in -[UIViewController _updateViewSafeAreaInsetsAndEagerlyUpdateContentScrollView:] () #14 (null) in -[UIViewController _setContentOverlayInsets:andLeftMargin:rightMargin:] () #15 (null) in __121-[UIViewController __updateContentOverlayInsetsWithOurRect:inBoundsOfAncestorViewController:viaImmediateChildOfAncestor:]_block_invoke () #16 (null) in -[UIViewController __updateContentOverlayInsetsWithOurRect:inBoundsOfAncestorViewController:viaImmediateChildOfAncestor:] () #17 (null) in -[UIViewController _updateContentOverlayInsetsFromParentIfNecessary] () #18 (null) in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] () #19 (null) in CA::Layer::layout_if_needed(CA::Transaction*) () #20 (null) in CA::Layer::layout_and_display_if_needed(CA::Transaction*) () #21 (null) in CA::Context::commit_transaction(CA::Transaction*, double, double*) () #22 (null) in CA::Transaction::commit() () #23 (null) in _UIApplicationFlushCATransaction () #24 (null) in _UIUpdateSequenceRun () #25 (null) in schedulerStepScheduledMainSection () #26 (null) in runloopSourceCallback () #27 (null) in CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION () #28 (null) in __CFRunLoopDoSource0 () #29 (null) in __CFRunLoopDoSources0 () #30 (null) in __CFRunLoopRun () #31 (null) in CFRunLoopRunSpecific () #32 (null) in GSEventRunModal () #33 (null) in -[UIApplication _run] () #34 (null) in UIApplicationMain () #35 0x00000001020e8118 in main at /Users/macbook/Desktop/SS-Origin-Swift/SSApp/NotesView.swift:14 #36 (null) in start ()
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’21
Reply to iOS 15 SwiftUI App crashes SOMETIMES on SOME devices
I have confirmed that is also is a problem on iOS 14, but I can not edit this post, so just posting updates and reproducible code here: import SwiftUI struct ContentView: View {     var body: some View {         NavigationView {             VStack {                 NavigationLink(destination: SecondView()) {                     Text("Click Me to go to second view (MAY FREEZE)")                 }.padding()                 NavigationLink(destination: ThirdView()) {                     Text("Go to third view first (Multi-Layer)")                 }.padding()                              }         }     } } struct SecondView: View {          @State var downloading = false     @State var message = "Please Wait"          var body: some View {         LoadingView(isShowing: $downloading, message: $message) {             VStack {                 Spacer()                 HStack{                     Spacer()                     Text("This is a second view.").padding()                     Spacer()                 }                 Spacer()             }         }                  .onAppear(perform: {             downloading = true             let twoSecondsFromNow = DispatchTime.now() + 2.0             DispatchQueue.main.asyncAfter(deadline: twoSecondsFromNow) {                 downloading = false             }         })              } } struct ThirdView: View {     var body: some View {         NavigationLink(destination: SecondView()) {             Text("Click Me to go to second view (NO FREEZE)")         }     } } struct LoadingView<Content>: View where Content: View {          @Binding var isShowing: Bool     @Binding var message: String     var content: () -> Content          var body: some View {         GeometryReader { geometry in             ZStack(alignment: .center) {                                  self.content()                     .disabled(self.isShowing)                     .blur(radius: self.isShowing ? 3 : 0)                                  VStack {                     Text(self.message).multilineTextAlignment(.center)                     ProgressView()                 }                 .frame(width: geometry.size.width / 2,                        height: geometry.size.height / 5)                 .background(Color.secondary.colorInvert())                 .foregroundColor(Color.primary)                 .cornerRadius(20)                 .opacity(self.isShowing ? 1 : 0)                              }         }     } } struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView()     } }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to iOS 15 SwiftUI App crashes SOMETIMES on SOME devices
I have found the lines of offending code: struct LoadingViewMainDownloading<Content>: View where Content: View {     @Binding var isShowing: Bool     @Binding var message: String     var content: () -> Content     var body: some View {         GeometryReader { geometry in             ZStack(alignment: .center) {                 self.content()                     .disabled(self.isShowing)                     .blur(radius: self.isShowing ? 3 : 0)                 VStack {                     Text(self.message).multilineTextAlignment(.center)                     ActivityIndicator(isAnimating: .constant(true), style: .large)                 }                 .frame(width: geometry.size.width / 2,                        height: geometry.size.height / 5)                 .background(Color.secondary.colorInvert())                 .foregroundColor(Color.primary)                 .cornerRadius(20)                 .opacity(self.isShowing ? 1 : 0)             }         }     } } Removing the GeometryReader section does not help. I am using this in a view where it is wrapped around everything in the view and displays an activity indicator when triggered. This works completely fine when built with ios14 binaries, but when built on iOS 15, it causes the freezing issue on certain devices.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to iOS 15 SwiftUI App crashes SOMETIMES on SOME devices
Special note: the user reports this does not freeze the app when selecting this nav link after rotating the phone into landscape mode.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to iOS 15 SwiftUI App crashes SOMETIMES on SOME devices
Special note: the user reports that the nav link does not freeze or cause a crash when the app is placed into landscape mode.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to iOS 15 SwiftUI App crashes SOMETIMES on SOME devices
Here is another TestFlight Crash report, same user: Thread 0#0 (null) in _getNSValueBytes () #1 (null) in -[NSValue(NSValueUIGeometryExtensions) UIEdgeInsetsValue] () #2 (null) in -[UIApplicationSceneSettings safeAreaInsetsPortrait] () #3 (null) in -[UIWindowScene _safeAreaInsetsForInterfaceOrientation:] () #4 (null) in -[UIWindow _sceneSafeAreaInsetsIncludingStatusBar:] () #5 (null) in -[UIScrollView _baseInsetsForAccessoryOnEdge:hasCustomClientInsets:accessorySize:additionalInsetFromEdge:] () #6 (null) in -[UIScrollView _effectiveHorizontalScrollIndicatorInsets] () #7 (null) in -[UIScrollView _layoutHorizontalScrollIndicatorWithBounds:effectiveInset:contentOffset:fraction:additionalInset:cornerAdjust:showing:recalcSize:verticalIndicatorFrame:] () #8 (null) in -[UIScrollView _adjustScrollerIndicators:alwaysShowingThem:] () #9 (null) in -[UIScrollView _updateForChangedScrollIndicatorRelatedInsets] () #10 (null) in _UIScrollViewAdjustForOverlayInsetsChangeIfNecessary () #11 (null) in -[UIScrollView setSafeAreaInsets:] () #12 (null) in -[UIView _eagerlyUpdateSafeAreaInsetsToDescendant:] () #13 (null) in -[UIViewController _updateViewSafeAreaInsetsAndEagerlyUpdateContentScrollView:] () #14 (null) in -[UIViewController _setContentOverlayInsets:andLeftMargin:rightMargin:] () #15 (null) in __121-[UIViewController __updateContentOverlayInsetsWithOurRect:inBoundsOfAncestorViewController:viaImmediateChildOfAncestor:]_block_invoke () #16 (null) in -[UIViewController __updateContentOverlayInsetsWithOurRect:inBoundsOfAncestorViewController:viaImmediateChildOfAncestor:] () #17 (null) in -[UIViewController _updateContentOverlayInsetsFromParentIfNecessary] () #18 (null) in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] () #19 (null) in CA::Layer::layout_if_needed(CA::Transaction*) () #20 (null) in CA::Layer::layout_and_display_if_needed(CA::Transaction*) () #21 (null) in CA::Context::commit_transaction(CA::Transaction*, double, double*) () #22 (null) in CA::Transaction::commit() () #23 (null) in _UIApplicationFlushCATransaction () #24 (null) in _UIUpdateSequenceRun () #25 (null) in schedulerStepScheduledMainSection () #26 (null) in runloopSourceCallback () #27 (null) in CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION () #28 (null) in __CFRunLoopDoSource0 () #29 (null) in __CFRunLoopDoSources0 () #30 (null) in __CFRunLoopRun () #31 (null) in CFRunLoopRunSpecific () #32 (null) in GSEventRunModal () #33 (null) in -[UIApplication _run] () #34 (null) in UIApplicationMain () #35 0x00000001020e8118 in main at /Users/macbook/Desktop/SS-Origin-Swift/SSApp/NotesView.swift:14 #36 (null) in start ()
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to iOS 15 SwiftUI App crashes SOMETIMES on SOME devices
moved to "Answer" for better formatting
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’21