Skip to content
This repository was archived by the owner on Jul 6, 2019. It is now read-only.
This repository was archived by the owner on Jul 6, 2019. It is now read-only.

Place Picker in iPad Crashes #9

Open

Description

@muhaym

wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr
- line 1
NSGenericException: UIPopoverPresentationController (<UIPopoverPresentationController: 0x12b61d850>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.

Activity

  1. ali-h2010 commented on May 4, 2018

    @ali-h2010

    I am facing the same issue
    Unhandled managed exception:
    Objective-C exception thrown. Name: NSGenericException Reason: UIPopoverPresentationController (<UIPopoverPresentationController: 0x11bbc9ea0>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.

  2. muhaym commented on May 5, 2018

    @muhaym
    OwnerAuthor

    Since I am busy, till I work on next update, any one can take and fix the logic to support Ipads

  3. ali-h2010 commented on May 5, 2018

    @ali-h2010

    @muhaym Thanks for the update. It's better than ignoring the issues as some developers do.
    There are so much potential and features that you can also add such as changing map type ,pick multiple places ,...

    I don't have a lot of experience in swift or Objective C but if the code is clean and well documented, I might be able to somehow add those options if not already there.

  4. muhaym commented on May 5, 2018

    @muhaym
    OwnerAuthor

    This is pure C#, have a look at https://github.com/muhaym/CrossPlacePicker/blob/master/src/CrossPlacePicker/Plugin.CrossPlacePicker.iOS/CrossPlacePickerImplementation.cs

    This might be a simple fix.

    Regarding other features, if it's available in Google Place Picker for iOS and Android, I am happy to implement it, but I don't think Google Place Picker supports it. This is just wrapper over native Place Pickers provided by google, and I just made it dead simple to use it

  5. ali-h2010 commented on May 5, 2018

    @ali-h2010

    @muhaym is there a way for now just to handle the crashing?
    The code is surrounded with try and catch but the error occurs in the native code.

  6. muhaym commented on May 5, 2018

    @muhaym
    OwnerAuthor

    CurrentController.PresentViewController(controller, true, null);

    This is the place you have to add the fix, making it support Tablet.

    A reference is here, but need to make sure it's backwards compatible and don't break anything.

    https://stackoverflow.com/questions/42920340/uipopoverpresentationcontroller-should-have-a-non-nil-sourceview-or-barbuttonite

  7. ali-h2010 commented on May 14, 2018

    @ali-h2010

    @muhaym , what kind of technique did you use to covert the code from Swift or Objective C to C#?
    Can you please just refer me to a resource or method name so I can learn it myself?

  8. ali-h2010 commented on May 16, 2018

    @ali-h2010

    if anyone is facing this issue , you can handle the tablet size and show a message instead of the crash.
    if (Device.Idiom == TargetIdiom.Tablet) { await _pageDialogService.DisplayAlertAsync("Alert", "Taking picture is not supported in tablets, please use the remarks to describe the location.", "OK"); return; }

    I learned a little about how to create plugins. Xamarin has access to native SDK and you can add specific code in each platform. You can also call other libraries and use them. It's like creating a custom renderer or dependency service.

    I might work on a fix later but I am sure that the developer that I am very thankful for is the most expert to solve it in his coming update.

  9. dblookup commented on Jun 12, 2018

    @dblookup

    +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions