Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash When PartialSheet Appears Again? #25

Closed
jhparshall opened this issue May 2, 2020 · 6 comments
Closed

Crash When PartialSheet Appears Again? #25

jhparshall opened this issue May 2, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@jhparshall
Copy link

jhparshall commented May 2, 2020

PartialSheet is awesome and your work on 2.0 has been terrific! Thank you for what you are doing!

I have a bug in my prototype app. I do not know if it is caused by PartialSheet. I'm not as familiar with Xcode as I would like to be, and so you may want to ask me for more information.

Here is the setup:

  • I have a SwiftUI view called ViewA() that has a form. In that form is a view called MapVIew() that contains an MKMapView via UIViewRepresentable. MapView() has several params, one of which is a Bool for editing. MapView() within the form on ViewA() is not editable.
  • When the user taps on the MapView() in the form on ViewA(), a NavigationLInk pushes a new view, ViewB(), that contains a new instance of MapView() with the MKMapView, but this time it is editable.
  • In ViewB(), the user can center the user location, bring up a settings PartialSheet, and drop a pin by long-pressing on the MKMapView contained within MapView().
  • Within the settings PartialSheet, the user can change the map type (Standard, Satellite, Hybrid) and drop a pin exactly on the user's current location.
  • If the user taps on a dropped pin, detail about that pin is shown on another PartialSheet, including the reverse geocoded street address, the latitude, and the longitude. This PartialSheet also contains a button to remove the pin.
  • Only 1 dropped pin is shown at a time on the map. If the user drops another pin at the user location or long-presses on another location in the MKMapView, any pin that already exists is removed.
  • Both PartialSheets are closed by calling .closePartialSheet() on the PartialSheetManager environment object.
  • The MapView() instance on ViewA() and the MapView() instance on ViewB() show the same MKMapView data, including user location and a dropped pin, if it exists. The only differences which MapView() is editable and the sizes of the MapView() instances are different in ViewA() vs. ViewB().

A description of the problem:

  • As long as I stay on ViewB(), I can bring up the settings PartialSheet and drop pins on the user location as much as I would like. I can also drop as many pins as needed (one at a time) at other locations on the MKMapView and bring up the pin detail PartialSheet for each one without any problems.
  • However, if I back out ViewB() to the parent ViewA() with the form, tap on the MapView() in the form to go back to ViewB(), and then either 1) bring up the settings PartialSheet, or 2) show pin detail by tapping on the pin, the app crashes with Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1da55a12c).
  • Clarification: The crash occurs only after a PartialSheet is opened and closed on ViewB(), returning to ViewA(), going back to ViewB() and opening a PartialSheet.
  • In both crashes, the PartialSheet does not show before the crash.
  • This crash did not occur when I was using v1.0.3 of PartialSheet. It only appeared after I started using v2.1. (That doesn't mean I did not create a problem in my code when converting it to accommodate PartialSheet changes from 1.0.3 to 2.1.)
  • The code to bring up the settings PartialSheet and the pin detail PartialSheet are in two different files. The settings PartialSheet code is in ViewB() and the pin detail PartialSheet is in MapView().
  • When I print stack traces for both crashes, it appears to be caused by the same code location in SwiftUI. (SwiftUI 0x00000001da5600f0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5628144) The stack traces are pasted below.

Would it be possible that PartialSheet has a common bug that causes both crashes? What other information do you need from me?

Thank you very much for your help.

Jim


Crash with bringing up Map Settings PartialSheet

▿ 33 elements

0 : "0 ??? 0x000000011622466c 0x0 + 4666312300"
1 : "1 Cardigan 0x0000000104d69390 main + 0"
2 : "2 SwiftUI 0x00000001da5600f0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5628144"
3 : "3 SwiftUI 0x00000001da4152a0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 4272800"
4 : "4 SwiftUI 0x00000001da5600f0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5628144"
5 : "5 SwiftUI 0x00000001da4152a0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 4272800"
6 : "6 SwiftUI 0x00000001da55ff6c 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5627756"
7 : "7 SwiftUI 0x00000001da52baf8 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5413624"
8 : "8 SwiftUI 0x00000001da52aca0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5409952"
9 : "9 SwiftUI 0x00000001da0bdea4 3652361F-29A7-3130-AB4A-72A5F7BB506B + 769700"
10 : "10 SwiftUI 0x00000001da0be9f4 3652361F-29A7-3130-AB4A-72A5F7BB506B + 772596"
11 : "11 AttributeGraph 0x00000001ce264ef4 5CAF326B-142F-3CAC-AE1C-7B4271D0A801 + 114420"
12 : "12 AttributeGraph 0x00000001ce24c88c 5CAF326B-142F-3CAC-AE1C-7B4271D0A801 + 14476"
13 : "13 AttributeGraph 0x00000001ce24cd48 5CAF326B-142F-3CAC-AE1C-7B4271D0A801 + 15688"
14 : "14 AttributeGraph 0x00000001ce251cb0 5CAF326B-142F-3CAC-AE1C-7B4271D0A801 + 36016"
15 : "15 SwiftUI 0x00000001da1cad3c 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1871164"
16 : "16 SwiftUI 0x00000001da1caaf0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1870576"
17 : "17 SwiftUI 0x00000001da1ca768 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1869672"
18 : "18 SwiftUI 0x00000001da1ca8e0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1870048"
19 : "19 SwiftUI 0x00000001da4814b4 3652361F-29A7-3130-AB4A-72A5F7BB506B + 4715700"
20 : "20 SwiftUI 0x00000001da1ca8a8 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1869992"
21 : "21 SwiftUI 0x00000001da1e6678 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1984120"
22 : "22 SwiftUI 0x00000001da05ccdc 3652361F-29A7-3130-AB4A-72A5F7BB506B + 371932"
23 : "23 SwiftUI 0x00000001da05cc4c 3652361F-29A7-3130-AB4A-72A5F7BB506B + 371788"
24 : "24 SwiftUI 0x00000001da05cd7c 3652361F-29A7-3130-AB4A-72A5F7BB506B + 372092"
25 : "25 CoreFoundation 0x00000001a1fbec54 9624AAFD-5437-3772-A507-0F357875808D + 707668"
26 : "26 CoreFoundation 0x00000001a1fb98e4 9624AAFD-5437-3772-A507-0F357875808D + 686308"
27 : "27 CoreFoundation 0x00000001a1fb9d84 9624AAFD-5437-3772-A507-0F357875808D + 687492"
28 : "28 CoreFoundation 0x00000001a1fb9660 CFRunLoopRunSpecific + 480"
29 : "29 GraphicsServices 0x00000001ac3ca604 GSEventRunModal + 164"
30 : "30 UIKitCore 0x00000001a618e15c UIApplicationMain + 1944"
31 : "31 Cardigan 0x0000000104d693e0 main + 80"
32 : "32 libdyld.dylib 0x00000001a1e351ec 95B366E7-F5BD-3308-9416-24B35999029B + 4588"

Crash with bringing up Pin Detail Settings PartialSheet

▿ 31 elements
0 : "0 ??? 0x000000011509866c 0x0 + 4647913068"
1 : "1 Cardigan 0x000000010245d390 main + 0"
2 : "2 SwiftUI 0x00000001da5600f0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5628144"
3 : "3 SwiftUI 0x00000001da4152a0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 4272800"
4 : "4 SwiftUI 0x00000001da55ff6c 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5627756"
5 : "5 SwiftUI 0x00000001da52baf8 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5413624"
6 : "6 SwiftUI 0x00000001da52aca0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5409952"
7 : "7 SwiftUI 0x00000001da0bdea4 3652361F-29A7-3130-AB4A-72A5F7BB506B + 769700"
8 : "8 SwiftUI 0x00000001da0be9f4 3652361F-29A7-3130-AB4A-72A5F7BB506B + 772596"
9 : "9 AttributeGraph 0x00000001ce264ef4 5CAF326B-142F-3CAC-AE1C-7B4271D0A801 + 114420"
10 : "10 AttributeGraph 0x00000001ce24c88c 5CAF326B-142F-3CAC-AE1C-7B4271D0A801 + 14476"
11 : "11 AttributeGraph 0x00000001ce24cd48 5CAF326B-142F-3CAC-AE1C-7B4271D0A801 + 15688"
12 : "12 AttributeGraph 0x00000001ce251cb0 5CAF326B-142F-3CAC-AE1C-7B4271D0A801 + 36016"
13 : "13 SwiftUI 0x00000001da1cad3c 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1871164"
14 : "14 SwiftUI 0x00000001da1caaf0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1870576"
15 : "15 SwiftUI 0x00000001da1ca768 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1869672"
16 : "16 SwiftUI 0x00000001da1ca8e0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1870048"
17 : "17 SwiftUI 0x00000001da4814b4 3652361F-29A7-3130-AB4A-72A5F7BB506B + 4715700"
18 : "18 SwiftUI 0x00000001da1ca8a8 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1869992"
19 : "19 SwiftUI 0x00000001da1e6678 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1984120"
20 : "20 SwiftUI 0x00000001da05ccdc 3652361F-29A7-3130-AB4A-72A5F7BB506B + 371932"
21 : "21 SwiftUI 0x00000001da05cc4c 3652361F-29A7-3130-AB4A-72A5F7BB506B + 371788"
22 : "22 SwiftUI 0x00000001da05cd7c 3652361F-29A7-3130-AB4A-72A5F7BB506B + 372092"
23 : "23 CoreFoundation 0x00000001a1fbec54 9624AAFD-5437-3772-A507-0F357875808D + 707668"
24 : "24 CoreFoundation 0x00000001a1fb98e4 9624AAFD-5437-3772-A507-0F357875808D + 686308"
25 : "25 CoreFoundation 0x00000001a1fb9d84 9624AAFD-5437-3772-A507-0F357875808D + 687492"
26 : "26 CoreFoundation 0x00000001a1fb9660 CFRunLoopRunSpecific + 480"
27 : "27 GraphicsServices 0x00000001ac3ca604 GSEventRunModal + 164"
28 : "28 UIKitCore 0x00000001a618e15c UIApplicationMain + 1944"
29 : "29 Cardigan 0x000000010245d3e0 main + 80"
30 : "30 libdyld.dylib 0x00000001a1e351ec 95B366E7-F5BD-3308-9416-24B35999029B + 4588"

@AndreaMiotto
Copy link
Owner

Hi there, thank you for your feedback, can you please provide an example project? So I can do some test and try to understand the problem?
Thank you

@jhparshall
Copy link
Author

jhparshall commented May 3, 2020 via email

@AndreaMiotto
Copy link
Owner

Yes, just give me the link of a repo, or upload somewhere the code of the example project.
Please make the example project as small as possible in terms of code

@jhparshall
Copy link
Author

Done. Sent you invite to private repo. Thx.

@AndreaMiotto AndreaMiotto added the bug Something isn't working label May 5, 2020
@NicholasBellucci
Copy link

I was able to fix this issue by adding

@Published var isPresented: Bool = false {
    didSet {
        if !isPresented {
            DispatchQueue.main.asyncAfter(deadline: .now() + 0.35) {
                self.content = AnyView(EmptyView())
            }
        }
    }
}

This will be temporary as I am sure there is a better solution. Just thought it could be helpful to try and narrow down the bug.

@AndreaMiotto
Copy link
Owner

resolved with version 2.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants