Hi all
Unbelievable, but true.
I now have wasted more than two days to search problems and bring my app to work again.
I wrote here in the hope, I can prevent other developers to do the same odyssey...
My app is based on the template: Blank App (Xamarin.Forms Shared).
I actually have installed XF 1.4.1-pre-1 and (thought), I had updated to iOS unified months ago. ..
I have done the update to unified according to the description here:
developer.xamarin.com/guides/cross-platform/macios/updating-xamarin-forms-apps/
(including running the migration-tool)
I now want to use some services from XLabs 2.x (e.g. device-service).
Therefore, I have implemented the services according to some partial descriptions, I have found.
I was able to implement the service in Android and WP.
By doing the implementation in iOS, I had the problems to register the service (AppleDevice) with:
var container = new XLabs.Ioc.SimpleContainer();
container.Register<IDevice>(t => AppleDevice.CurrentDevice);
error-message:
"t => AppleDevice.CurrentDevice" "Cannot convert lambda expression to type 'System Type' because it is not a delegate type"
I then have searched for information’s and found a message from another user that had the same-problem, as he don’t had migrated to unified…
I then have checked my references and … had to note, that I still had the old references, although, I have thought, I have done the migration a longer time ago.
Then, I have run the migration-tool once again, without success (nothing happened).
Then, I have read the migration-guide once again and also the guide, how to migrate an iOS-project:
developer.xamarin.com/guides/cross-platform/macios/updating_ios_apps/#Steps_to_Update_Manually
In the description to “1. Update Project Type & Build Target” I have seen, that - in the description - the (to change) key is I uppercase (in my .csproj-File, it was in lowercase):
Change the project flavor in your csproj files from 6BC8ED88-2882-458C-8E55-DFD12B67127B to FEACFBD2-3405-455C-9665-78FE426C6842. Edit the csproj file in a text editor, replacing the first item in the element as shown
I then have changed the key to uppercase and re-run the migration tool:
- By the first try a “meaningful” error-message was showed ("an error has occurred" )
- By the second try, there were showed some messages to my .cs-files (so that I have seen, that the tool has done “something” (not sure as the uppercase-change was the reason, that it have done something).
Then I have removed the namespace “monotouch” in my usings manually, de-installed and re-installed all NugGet-packages.
After doing that, all Xamarin-references in my iOS-Project were changed to the new api:
\lib\Xamarin.iOS10\
Then I had a problem with Xamarin.Mobile (what I need for Geolocation).
I was not able, to compile my iOS-project as the following error-message was showed:
'Xamarin.iOS.dll' is referenced explicitly, while 'monotouch.dll' is referenced by 'Xamarin.Mobile, Version=0.7.1.0, Culture=neutral, PublicKeyToken=null'. (MT0034) (########)
I then first looked for an update to xamarin.mobile in NuGet.Manager and also on the web-interface of NuGet and found… nothing (latest available version 0.7.1).
I further was not able to remove the xamarin.mobile-package with NuGet and also not to update the package in the NuGet-console…
I have then (by chance) looked also to the xamarin.mobile-package in the component-store:
https://components.xamarin.com/view/xamarin.mobile
and… was very surprised, as I found an version 0.75 there (including a small note to the unified-update).
So it will not be too easy, the package cannot be installed with NuGet-manager/console.
First, I have downloaded the package (after login with my Xamarin-Account), then I wonder, how to get the software in my project (as I also not have found any description, how to do this).
I the have searched further and have found, that components can be installed, by right-click the entry “components“ to the project and then select “Edit Components” / “Get more components”.
I then have select “Get more components”, searched the Xamarin.Mobile Component (0.75) and added it to the iOS-Project.
After that, I was able to compile my iOS-project again and also the Device-Service (from XLabs) seems to work now.
Conclusion:
If (you think), you already have migrated to unified, it may be a good idea to check the references in your iOS-project:
=> the Xamarin-references should be on: \lib\Xamarin.iOS10\ (not on \lib\MonoTouch10)
If you use / want to use xamarin.mobile with unified, you have to install it manually
If you want to use XLabs 2.x, you may also find this information’s useful
Hope this helps somebody…