Programming

Application Loader, Xamarin and GoogleCast v3 Binding Library

I recently had to upload a new version of an Xamarin.iOS application and used the Application Loader to do so. The difference between the previous and new version  of the application was that the new one included a Binding Library for Google ChromeCast v3.

When I tried to upload, I got the following error:

I spent days tracking down the issue by both reading the official documentation and forums. By sheer luck, I tried uploading using the Organizer in XCode. To my surprise, the application was successfully uploaded to iTunes Connect and started processing. Although, after some time, I received a mail stating that:

[…] The app’s Info.plist must contain an NSBluetoothPeripheralUsageDescription key with a string value explaining to the user how the app uses this data.

Looking at the documentation, it was quite clear that I indeed had forgotten to define the NSBluetoothPeripheralUsageDescription key.

After resolving the issue, I tried uploading using the Application Loader. Unfortunately, the same issue occurred. Instead, I used the Organizer in XCode, and this time, the application was uploaded and processing completed. What a relief!

Lessons learned

Seemingly, the Application Loader doesn’t handle Binding Libraries from Xamarin.iOS that well when they are included as a Framework. Going forward, I’ll instead use the Organizer in XCode for publishing.

I am although certain that other developers will stumble upon this issue as well. Conclusively, Apple should either consider resolving the issue with the Application Loader or remove it from the market entirely.

Standard
Programming

Json.NET crashes when releasing an Xamarin.Android Application

So, after I published my last post, some users reported that the Android app I’m developing didn’t contain any content.

This seemed weird to me, as I knew for a fact, that the iOS version worked just fine.

Fortunately, I am using Xamarin.Insights, which allows me to monitor issues that may arise.

Apperently, the users whom had installed the Android app experienced a lack of content due to a JSON serialization issue which meant that no data was shown – ofcourse, this should be handled by presenting an error message in the UI as well.

The reason was, apparently, that Json.NET crashes in release mode under Xamarin.Android, but not when debugging, which is why I didn’t initially experience the issue myself.

The solution

What you need to do if you experience this issue is to follow these simple steps:

  1. In Visual Studio / Xamarin Studio, right click on your Android project and select “Properties”
  2. Go to “Android Options” => “Linker”
  3. In the field “Skip linking assemblies” enter “System.Core” (without the quotes)
    1. Note: if you have already omitted other assemblies, seperate them using “;” (quotes omitted)
  4. Save

Now, you can release your Android app once more without having Json.NET crashing.’

Testing the solution

If you want to be sure that the solution works before publishing your app to the Google Play Store, you can:

  1. Set your “Solution Configuration” to “Release”
  2. In Visual Studio, open the “Debug” menu
  3. Now click “Start Without Debugging”

Doing so allows the application to be installed in release-mode on your emulator/device.

// Dave

Standard
Programming

OxyPlot and Xamarin.Forms Unified API

I finally figured out what was wrong with my references in my iOS project!

Once I uninstalled OxyPlot.Xamarin.Forms, and installed the new 707-alpha PR, it was for “some reason” (actually a very good one, which you’ll see later) still referencing the Classic iOS OxyPlot.Xamarin.Forms API.

I was frustrated by this fact, since, when I created a new project, this was not an issue at all. This got me thinking.

Once upon a time, when I started my project, I was running Xamarin.Forms 1.2.3, and I have by now simply upgraded to the newest version (1.3.1.6296). I did some refactoring of my classes based on the post below, and thought that I was now running the Unified API:
http://www.infinite-x.net/2014/10/09/xamarin-forms-1-3-0-preview-formapplication/

Alas, upon further investigation, I found , that I had in fact NOT upgraded to the Unified API in my .csproj file:
http://developer.xamarin.com/guides/cross-platform/macios/updating_ios_apps/#Steps_to_Update_Manually

I followed the steps, removed OxyPlot, re-installed the 707 OxyPlot.Xamarin.Forms PR from the NuGet Package Manager Console.

Hereafter, everything worked as expected, and I could finally include the OxyPlot.Xamarin.Forms package for the Unified iOS project as described in the OxyPlot documentation: http://oxyplot.org/documentation/hello-xamarin-forms

// David

Standard