Saturday, August 27, 2016

Learning Resources - Sitecore Mobile SDK for Xamarin

Recently I was searching for more learning materials on Sitecore Mobile SDK for Xamarin and was able to found lot of information which I have not come across earlier..

So, I thought I will share those links with you, in case someone find it useful..


Mobile SDK Source and Nuget packages


Sitecore Mobile SDK for Xamarin - Xamarin Website
https://components.xamarin.com/gettingstarted/sitecore.mobile.sdk - Xamarin Website

https://github.com/Sitecore/sitecore-xamarin-pcl-sdk - Sitecore


dev.sitecore.net

https://dev.sitecore.net/Downloads/Sitecore_Mobile_SDK_for_Xamarin/1_0/Sitecore_Mobile_SDK_10_for_Xamarin.aspx


doc.sitecore.net


https://doc.sitecore.net/mobile_sdk_for_xamarin/managing_content_with_the_mobile_sdk


Advance Blog series by Sitecore MVP Goran




Blogs by Sitecore MVP Chaturanga (Me - SitecoreFootstep :-D )




Friday, August 19, 2016

SUGCON-EUROPE 2016 by Sitecore Footsteps Eye

I recently participated for Sitecore User Group Conference Europe 2016 which was held in Copenhagen, Denmark. 

It was a great event with lot of knolwedge shared and great Sitecore community participation.

I traveled from Colombo, Sri Lanka and reach Copenhagen on Saturday (23rd April).

On Sunday, met lot of Sitecore Commuinty experts/MVPs/friends and had a boat ride to see Copenhagen.


Event started Monday (25th April) with lot of Sitecore community participating not only from the Europe, but globally.




Unicorn by Kam Figy

Sitecore MVP Awards




Met an Old Friend - Jon Kasimir from IFS

Sitecore MVP Awards Ceramony


Sitecore Marketing Summit - Copenhagen

Awards for SUGCON-EU Organisers by Pieter

Sitecore Technology MVP 2016 Award

All the Presents & Memories from SUGCON-EU 2016


The End !

Saturday, August 6, 2016

How to Structure Your Xamarin Solution by Adhering to Common .NET Practices - Colombo Xamarin Meetup Presentation

Last month (July 2016) I presented at the Colombo Xamarin Meetup in Sri Lanka, which was the 3rd meetup of the group.

My topic for the meetup presentation was "How to Structure Your Xamarin Solution by Adhering to Common .NET Practices", where we discussed how to use Repository Pattern, Dependency Injection and How to called third party services from apps.

I took the approach of initially having a very simple application with all the code in the code behind file. Then, I showed how step by step you can convert this simple application to use Repository Patter and also apply Dependency Injection (using Autofac DI Container) to minimize the tight coupling of code layers.

Also, we discussed drawbacks of Xamarin Forms default DependencyService approach to implemented platform specific code and how we can use Depencency Injection container (using Autofac) to achieve same functinoality with minimun coupling.

Finally we discussed how we can call third party service API from Xamarin Forms application by taking Sitecore Mobile SDK for Xamarin.


Following are the slide which was used for the presentation




You can find the code that I used for the presentation by following GitHub link




Happy Xamarin! :-)

Friday, August 5, 2016

Xamarin.Forms InitializeContext Does Not Exists In The Current Context Error Due to Title Property in ContentPage tag


I am new to Xamarin.. As a first app with Xamarin I started to develop an cross-platform mobile application to one of my friends project.
After creating a new Xamarin Forms project in Visual Studio and started to add new pages by looking at examples in Xamarin developer website.

But, after some time, I started to receive an issue in my Visual Studio project. The error was, it starts to give "The name 'initializeContext' does not exists in the current context" error.. it comes suddenly and stays..

I tried clean and rebuild the VS project. Also, remove Xamarin.Forms NuGet package folder and restored it. But, anything didn't solve my issue.


But, After looking into xaml pages I remember that I added "Title" property to "ContentPage" nodes..

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"             x:Class="MyFirst.Mobile.App.Pages.HomePage"             Title="Home">

I just tried to remove that property and that is.. Everything started to work again...


Even thought I can see this "Title" property in Xamarin Developer website examples, it sometimes started to return some unexpected results...


So, I hope if this helps someone who faces this same issue in future...

Happy Xamaring... :-)

Monday, July 25, 2016

Presenting at Colombo Xamarin Meetup in Sri Lanka - How to Organize Your Xamarin Solution

At the upcoming meetup organized by Colombo Xamarin Meetup team, I'm presenting "How to Organize Your Xamarin Solution"

http://www.meetup.com/Colombo-Xamarin-Meetup/events/232773783/


In the presentation, I am planing to talk about how to organize your Xamarin Solution by adhering to common .NET practices and Design Pattners.

Also, I will talk about how Xamarin application can talk to third-party SDK and work with them by using Sitecore Mobile SDK for Xamarin.


Hope to See you on Thursday ! :-)



Following is the banner for the meetup created by Colombo Xamarin Meetup team.

Image Credit : Colombo Xamarin Meetup

Thursday, June 16, 2016

How to Setup and Test WhiteLabel-iOS App Provided by Sitecore Mobile SDK Team On Xamarin Studio on Mac

Recently, I need to try out the WhiteLabel-iOS mobile application provided by Sitecore Mobile SDK GitHub repository. Even though it was not hard to setup and test this, I had to solved few minor issue which I thought might help someone in future.

So, following are the steps you need to do in order to setup and run WhiteLabel-iOS mobile app on your Macbook with Xamarin Studio.

Note: I assume that you have already installed Xcode and Xamarin Studio into you Macbook

Step 1: Setup Sitecore instance

In this case, I am using Windows with Parallels software on my macbook. So, I setup Sitecore Habitat website instance in my windows VM with the host name of "habitat.local"


Step 2: Configure access to Sitecore instance from Macbook

You can see full setup instruction of a normal .NET website with access from mac from following url
https://www.getdonedone.com/accessing-your-windows-development-environment-from-osx/

Some of the main steps that I did was,
Disabled the Firewall in Windows
Added the host entry into Macbook /private/etc/hosts file


So, now I can visit "http://habitat.local" from my Macbook Pro.



Step 3: Clone Sitecore Mobile SDK for Xamarin repository

Open a Terminal window and clone the github repo
https://github.com/Sitecore/sitecore-xamarin-pcl-sdk


Step 4: Open WhiteLable-iOS solution from Xamarin Studio and run Simulator

After cloning the github repository, open "/sitecore-xamarin-pcl-sdk/solutions/WhiteLabel-iOS.sln"  solution file from Xamarin Studio and run Simulator

At this point, you will receieve an error message with Simulation failing



Error : /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets: Error: No installed provisioning profiles match the installed iOS signing identities. (WhiteLabel-iOS)


Solution :
To solve above issue, you need to manuall edit the related .csproj file (i.e. "/sitecore-xamarin-pcl-sdk/app/WhiteLabel/iOS/WhiteLabel-iOS/WhiteLabel-iOS.csproj") and remove following tags from that file
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
Reference :
http://forums.xamarin.com/discussion/39534/cant-build-ios-in-xamarin-studio-5-7-1-through-5-9
http://stackoverflow.com/questions/30724551/no-installed-provisioning-profiles-match-the-installed-ios-code-signing-keys-in


After that, I was successfully able to launch WhiteLabel-iOS app from Xamarin Studio and run Simulator on it.



Step 5: Configure App Settings

As final step, I clicked on the "Edit" icon in top right corner of the application to visit Settings page of the application. There I gave "http://habitat.local" (which is my windows installed Sitecore instance) as my hostname for the website.



Now, I can run the application and test the operations/functionality in that application.


Happy Sitecore + Xamarin !  :-)

Monday, June 13, 2016

Issue While Trying to Add Sitecore Mobile SDK NuGet Packages into Shared Portable Xamarin Project

Recently, I tried to create a new Xamarin Forms solution to test Sitecore Mobile SDK.

First I creating Xamarin Forms solution in Visual Studio.



Then I tried to add following NuGet Package into the Shared Portable Forms project.


Sitecore Mobile SDK for Xamarin NuGet Packages

Once I tried to Install the "Sitecore.MobileSDK.Xamarin" NuGet packages into the project, it failed the installation with following error message.

Error : Could not install package 'Sitecore.MobileSDK.Xamarin 1.0.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

I reported this behaviour to the team who handles Sitecore Mobile SDK development and they are very helpful and came back to me with the issue.

Reason for above mention issue was that current Sitecore Mobile SDK for Xamarin build assemblies does not support ASP.NET Core 1.0 yet (as of 13/06/2016).




Sitecore Mobile SDK team will work on this issue and will release assemblies in coming few days.


As a workaround, the team suggested to use their source code and build the libraries locally.

You can find the Sitecore Mobile SDK from following Git repository
https://github.com/Sitecore/sitecore-xamarin-pcl-sdk


NOTE: Adding these Sitecore Mobile SDK NuGet packages into Xamarin Studio does work without any issues.


UPDATE : 25/07/2016
    Sitecore Mobile SDK team has provided a update for there NuGet feeds, which has solved the above mention issue:
        Sitecore.MobileSDK.Xamarin 1.0.2-beta1
        Sitecore.MobileSDK.PasswordProvider 1.0.3-beta1