Can't get ListView to run on iOS (with XLabs and Prism)

7 posts, 0 answers
  1. Erik
    Erik avatar
    43 posts
    Member since:
    Jan 2011

    Posted 11 Sep 2015 Link to this post

    Hi -

    I've created a very simple project (Xamarin Forms PCL with iOS and Android) and am having trouble with the iOS portion for the Telerik ListView. 

     The project is on GitHub here and should be runnable -- it runs correctly on Android, and also runs on iOS but the ListView is not rendered:

    https://github.com/dahlsailrunner/TelerikSample

     

    Here are some notes about the project:

    * It uses Prism for MVVM and all refs are added

    * It uses XLabs to use some other controls like ImageButton and Checkbox which are more feature-rich than core Xamarin Forms at this point

    * It has the refs for Telerik as described in the Getting Started article for Xamarin Forms ListView.

    The MainPage is loaded at startup by the Prism Bootstrapper class, and the ViewModel with it also gets instantiated properly.  I have some mocked data returned and am trying to display it in a list view when the MainPage displays.  This works perfectly on Android.

    On iOS, I can't get it to work.  My AppDelegate.cs is shown below.  If I comment in the ExportRenderer line, the app fails to start with a "obj cannot be null" error (this should be easily reproduced if you like via the GitHub source - which should be runnable assuming you have the refs taken care of.

    I believe it's not working because I haven't been able to properly export the ListView Renderer for iOS, but I'm not sure why that doesn't work.

    Any help / guidance is appreciated.

    -Erik

     

    using System;
    using System.Collections.Generic;
    using System.Linq;
     
    using Foundation;
    using UIKit;
    using XLabs.Forms;
    using Xamarin.Forms;
    using Xamarin.Forms.Platform.iOS;
    using Telerik.XamarinForms.DataControlsRenderer.iOS;
     
    //[assembly: Xamarin.Forms.ExportRenderer(typeof(Telerik.XamarinForms.DataControls.RadListView), typeof(Telerik.XamarinForms.DataControlsRenderer.iOS.ListViewRenderer))]
     
    namespace TelerikSample.iOS
    {
        // The UIApplicationDelegate for the application. This class is responsible for launching the
        // User Interface of the application, as well as listening (and optionally responding) to
        // application events from iOS.
        [Register("AppDelegate")]
        public partial class AppDelegate : FormsApplicationDelegate //XFormsApplicationDelegate//global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
        {
            //
            // This method is invoked when the application has loaded and is ready to run. In this
            // method you should instantiate the window, load the UI into it and then make the window
            // visible.
            //
            // You have 17 seconds to return from this method, or iOS will terminate your application.
            //
            public override bool FinishedLaunching(UIApplication app, NSDictionary options)
            {
                new Telerik.XamarinForms.DataControlsRenderer.iOS.ListViewRenderer();           
     
                Forms.Init();
                LoadApplication(new App());
                 
                return base.FinishedLaunching(app, options);
            }
        }
    }
     

     


     
  2. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 14 Sep 2015 Link to this post

    Hi Erik,

    You do need the ExportRenderer attribute to be present in the code. With it, there is an ArgumentNullException thrown, which will be fixed in our next release, expected by the end of September.

    Best regards,
    Ves
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. Erik
    Erik avatar
    43 posts
    Member since:
    Jan 2011

    Posted 14 Sep 2015 in reply to Ves Link to this post

    Thanks for the reply -- I will update my ref version when you make the new release available, and update this thread with my results when I have them.  Thanks for the reply!

    -Erik

  5. Erik
    Erik avatar
    43 posts
    Member since:
    Jan 2011

    Posted 29 Sep 2015 Link to this post

    Just wondering about this next release.  Almost here?  Anxious to see how this will work on iOS and if we will run into any other downstream issues (this is a blocking failure for me at present). 

    I'm patient -- just wondering what the latest status is.  Thanks in advance.

    -Erik

  6. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 02 Oct 2015 Link to this post

    Hi Erik,

    We released new version of our suite and the issue was addressed. You can take advantage of the fix by downloading the latest version from your Telerik account.

    Please give it a try and let us know if you need any further assistance.

    Regards,
    Pavel R. Pavlov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  7. Erik
    Erik avatar
    43 posts
    Member since:
    Jan 2011

    Posted 02 Oct 2015 Link to this post

    Awesome!!  I confirmed that this does indeed work -- although I needed to do a couple of things beyond just re-running it.  I had to make the AppDelegate inherit from XFormsApplicationDelegate (I think this is because I am using XLabs -- which is probably pretty common for people -- I got a "could not load XLabs.Forms" if I didn't do this), and I also -- and more importantly to this thread -- needed to add the line TelerikForms.Init(); under Forms.Init(); and reference Telerik.XamarinForms.Common.iOS in order to do it.

    Then everything worked!!

    Thanks a lot.

    -Erik

  8. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 05 Oct 2015 Link to this post

    Hi Erik,

    We are happy to hear your issues are resolved in our latest build :)

    Let us know if you need any other assistance.

    Regards,
    Pavel R. Pavlov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner