Giter Club home page Giter Club logo

Comments (8)

mhdostal avatar mhdostal commented on September 19, 2024

The same crash will occur when attempting to add a new feature and there is more than one feature layer in the map. When there is more than one FL, an AlertController is displayed allowing the user to select which FL to add the feature two. The default configuration in the app has only one FL, so this crash would not happen in that case.

from data-collection-ios.

mhdostal avatar mhdostal commented on September 19, 2024

There are two separate instances of the crash with the UIAlertViewController: image source selection and Feature Layer selection.

The first, image source selection can be solved by changing the type of the UIAlertController to .alert from .actionSheet. There is no barButtonItem in this case as it's triggered by tapping on the AddAttachment row in a table. Also, the display of the action sheet is many layers removed, code-wise, from the table view so that passing in a source view and rect is not practical. So in this case, .alert is the best bet. It will look like this:

image

The second, feature layer selection, can be handled either by making the UIAlertController an .alert OR by passing in a UIBarButtonItem (which the actionSheet would be presented from on an iPad). The bar button item case would involve passing the sender from the @IBAction for the "add feature" button to the func userRequestsAddNewFeature(_ sender: Any) method in MapViewController+LocationSelection extension. The two options look like this:

Alert (both iPhone and iPad look the same):

image

BarButtonItem:

iPhone (this is unchanged from the original code):

image

iPad:

image

@esreli @mikewilburn Do either of you have a preference between using .alert vs. UIBarButtonItem in how the UI is presented?

from data-collection-ios.

mikewilburn avatar mikewilburn commented on September 19, 2024

Thanks for the consideration @mhdostal, but my recommendation here would mean very little. I defer to @esreli!

from data-collection-ios.

esreli avatar esreli commented on September 19, 2024

From a UI perspective, it would be my preference to keep the alert controller configured as an .actionSheet, specifying the UIBarButtonItem's view geometry as the source rect.

@mhdostal what do you think?

from data-collection-ios.

mhdostal avatar mhdostal commented on September 19, 2024

@esreli I'm cool with keeping the .actionSheet for the layer selection and passing in the UiBarButtonItem.

For the image source selection alert controller it's not so easy. There is no UIBarButtonItem, only the "Add Attachments" table view cell. In the call stack below, ImagePickerPermissions.request(options:) is where the UIAlertController is presented. The action is initiated by a tap on the "Add Attachments" row, so that's would require passing a sourceView and sourceRect down more than one level deep.

#0	0x0000000104d304e0 in ImagePickerPermissions.request(options:) at /Users/mark1113/Development/OpenSourceApps/data-collection-ios/data-collection/data-collection/Utilities/ImagePickerPermissions.swift:181
#1	0x0000000104db58e0 in RichPopupViewController.attachmentsViewControllerDidRequestAddAttachment(_:) at /Users/mark1113/Development/OpenSourceApps/data-collection-ios/data-collection/data-collection/View Controllers/Rich Popup View Controllers/Rich Popup View Controller/RichPopupViewController+RichPopupAttachmentsViewControllerDelegate.swift:41
#2	0x0000000104db60b8 in protocol witness for RichPopupAttachmentsViewControllerDelegate.attachmentsViewControllerDidRequestAddAttachment(_:) in conformance RichPopupViewController ()
#3	0x0000000104de6af8 in RichPopupAttachmentsViewController.tableView(_:didSelectRowAt:) at /Users/mark1113/Development/OpenSourceApps/data-collection-ios/data-collection/data-collection/View Controllers/Rich Popup View Controllers/Rich Popup View Controller/RichPopupAttachmentsViewController/RichPopupAttachmentsViewController+UITableViewDelegate.swift:74

So for the image source selection alert controller, I'd say we switch to the .alert option.

from data-collection-ios.

esreli avatar esreli commented on September 19, 2024

The action is initiated by a tap on the "Add Attachments" row, so that's would require passing a sourceView and sourceRect down more than one level deep.

I see now what you're saying.

So for the image source selection alert controller, I'd say we switch to the .alert option.

I thought we might be able to avoid presenting the user with the notion of an alert, which (to me, at least) implies the user has reached a barrier, in favor of prompting them to take an action. It also appears we have way to present a modal .actionSheet in any other style than .popover. Without some sort of UI anchor, it looks like UIKit has forced our hand on this one.

Admittedly, amidst the other tasks i'm attending to simultaneously, I didn't investigate the issue as thoroughly as I would have needed to. I'm sorry & i'll do better next time.

from data-collection-ios.

mhdostal avatar mhdostal commented on September 19, 2024

In iOS 13 presenting the image source selection alert controller no longer crashes when using .actionSheet without a UIBarButtonItem or setting a sourceView/sourceRect.

from data-collection-ios.

mhdostal avatar mhdostal commented on September 19, 2024

Verified in the v1.1.2 release.

from data-collection-ios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.