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

AlertRow crashing when selecting on Beta5 #1629

Closed
diegogarciar opened this issue Aug 5, 2018 · 8 comments
Closed

AlertRow crashing when selecting on Beta5 #1629

diegogarciar opened this issue Aug 5, 2018 · 8 comments

Comments

@diegogarciar
Copy link

diegogarciar commented Aug 5, 2018

The following code is working fine on simulator but is crashing on my recently updated iPhone 6s with developer beta 5

            section <<< AlertRow<String>("logout"){
           
           $0.title = "logoutTitle"
            $0.selectorTitle = "signOutMessage"

            $0.cancelTitle = "cancel"
            
            $0.options = ["ok"]
            
            }.onChange({ (row) in
                self.logout()
            })

I'm receiving this error:
Could not cast value of type 'Swift.Optional<Eureka.RowOf<Swift.String>>' (0x114b36648) to 'Eureka._AlertRow<Eureka.AlertSelectorCell<Swift.String>>' (0x114b1d970).

@mats-claassen
Copy link
Member

Can you show us a stack trace where that is happening?

@diegogarciar
Copy link
Author

diegogarciar commented Aug 6, 2018

yes, I forgot to mention is crashing when selecting the cell.

here is the trace
'Swift.Optional<Eureka.RowOf<Swift.String>>' (0x1111bd418) to 'Eureka._AlertRow<Eureka.AlertSelectorCell<Swift.String>>' (0x11093c010).

* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x000000018a9aa104 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x000000018aa25104 libsystem_pthread.dylib`pthread_kill$VARIANT$mp + 380
    frame #2: 0x000000018a901d78 libsystem_c.dylib`abort + 140
    frame #3: 0x00000001072e94d0 libswiftCore.dylib`swift::fatalError(unsigned int, char const*, ...) + 56
    frame #4: 0x00000001072e00a8 libswiftCore.dylib`swift::swift_dynamicCastFailure(void const*, char const*, void const*, char const*, char const*) + 76
    frame #5: 0x00000001072e0124 libswiftCore.dylib`swift::swift_dynamicCastFailure(swift::TargetMetadata<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*, char const*) + 120
    frame #6: 0x00000001072e204c libswiftCore.dylib`swift_dynamicCastImpl(swift::OpaqueValue*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*, swift::DynamicCastFlags) + 3392
    frame #7: 0x00000001072e20f4 libswiftCore.dylib`swift_dynamicCastImpl(swift::OpaqueValue*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*, swift::DynamicCastFlags) + 3560
  * frame #8: 0x0000000102ab7258 Eureka`SelectorAlertController.optionsProviderRow.getter(self=0x0000000136352000) at SelectorAlertController.swift:50
    frame #9: 0x0000000102ab7e84 Eureka`SelectorAlertController.viewDidLoad(self=0x0000000136352000) at SelectorAlertController.swift:68
    frame #10: 0x0000000102ab91f4 Eureka`@objc SelectorAlertController.viewDidLoad() at <compiler-generated>:0
    frame #11: 0x00000001b828c470 UIKitCore`-[UIViewController loadViewIfRequired] + 1000
    frame #12: 0x00000001b828c8a0 UIKitCore`-[UIViewController view] + 28
    frame #13: 0x00000001b7b9dc9c UIKitCore`-[UIAlertController _currentDescriptor] + 332
    frame #14: 0x00000001b7b9d884 UIKitCore`-[UIAlertController _updateProvidedStyleWithTraitCollection:] + 96
    frame #15: 0x00000001b7b9db40 UIKitCore`-[UIAlertController _updateProvidedStyle] + 60
    frame #16: 0x00000001b7b9dd64 UIKitCore`-[UIAlertController _resolvedStyleChanged] + 28
    frame #17: 0x00000001b7b9ac8c UIKitCore`+[UIAlertController alertControllerWithTitle:message:preferredStyle:] + 376
    frame #18: 0x00000001029c26e8 Eureka`@nonobjc UIAlertController.__allocating_init(title:message:preferredStyle:) at <compiler-generated>:0
    frame #19: 0x00000001029c5a68 Eureka`closure #1 in closure #1 in _AlertRow.presentationMode.getter(self=0x0000000135d82b80) at AlertRow.swift:34
    frame #20: 0x00000001029de118 Eureka`ControllerProvider.makeController(self=callback) at Core.swift:102
    frame #21: 0x00000001029dfaf0 Eureka`PresentationMode.makeController(self=presentModally) at Core.swift:203
    frame #22: 0x00000001029c63f8 Eureka`_AlertRow.customDidSelect(self=0x0000000135d82b80) at AlertRow.swift:50
    frame #23: 0x0000000102a84e44 Eureka`Row.didSelect(self=0x0000000135d82b80) at Row.swift:177
    frame #24: 0x00000001029ef430 Eureka`FormViewController.tableView(tableView=0x00000001361ad600, indexPath=2 indices, self=0x000000013620ec00) at Core.swift:777
    frame #25: 0x00000001029ef504 Eureka`@objc FormViewController.tableView(_:didSelectRowAt:) at <compiler-generated>:0
    frame #26: 0x00000001b80d0d24 UIKitCore`-[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1348
    frame #27: 0x00000001b80d0f88 UIKitCore`-[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 268
    frame #28: 0x00000001b7bd69a0 UIKitCore`_runAfterCACommitDeferredBlocks + 296
    frame #29: 0x00000001b7bc49a4 UIKitCore`_cleanUpAfterCAFlushAndRunDeferredBlocks + 384
    frame #30: 0x00000001b7bf3890 UIKitCore`_afterCACommitHandler + 132
    frame #31: 0x000000018ada312c CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
    frame #32: 0x000000018ad9ddc0 CoreFoundation`__CFRunLoopDoObservers + 412
    frame #33: 0x000000018ad9e360 CoreFoundation`__CFRunLoopRun + 1264
    frame #34: 0x000000018ad9db50 CoreFoundation`CFRunLoopRunSpecific + 436
    frame #35: 0x000000018d00d584 GraphicsServices`GSEventRunModal + 100
    frame #36: 0x00000001b7bcad68 UIKitCore`UIApplicationMain + 212
    frame #37: 0x000000010107479c TripLoop`main at AppDelegate.swift:24
    frame #38: 0x000000018a85e188 libdyld.dylib`start + 4`

@diegogarciar
Copy link
Author

diegogarciar commented Aug 6, 2018

What I found during debugging is that ViewDidLoad is being called before it should (at initialization)
frame #9: 0x0000000102ab7e84 EurekaSelectorAlertController.viewDidLoad(self=0x0000000136352000) at SelectorAlertController.swift:68`
and because of that, its trying to get the row which it is still nil as it is set after initialized

* frame #8: 0x0000000102ab7258 EurekaSelectorAlertController.optionsProviderRow.getter(self=0x0000000136352000) at SelectorAlertController.swift:50
`

@mats-claassen
Copy link
Member

I see. I think it is normal that you would gt problems if viewDidLoad is called too early.

I tried this with the AlertRow in the examples and the viewDidLoad is always called after setting the row.

Are you accessing the view or the controller of the alert somewhere else in the code which might lead to the view being loaded too early?

@diegogarciar
Copy link
Author

diegogarciar commented Aug 7, 2018

No, for testing I copied the row and inserted it in an empty form and got same result, I will try now installing the example into my iPhone and let you know.

My app has being working perfectly until I installed the iOS 12 Developer Beta 5, after that even my release apps started crashing. I hope it is a Beta bug, but if it isn't the AlertRow will fail in iOS 12.

[Update]
I installed the example project in iPhone 6s and crashed when selecting the AlertRow

@mats-claassen
Copy link
Member

It's not crashing for me running the examples on the simulator (iOS Beta 4). Did it crash with beta 4 as well for you? Does it only crash on the device?

@diegogarciar
Copy link
Author

Hey, just installed Beta 6 and it works again!
(I tested also the Example project)
Thank you anyways for your time

@mats-claassen
Copy link
Member

Good to hear that. I will close this issue then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants