Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Sample (not yet working) #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bigjonroberts
Copy link

@ReedCopsey I'm trying to get Gjallarhorn.Bindable working for iOS.

Ran into the following message trying to pull Gjallarhorn.Bindable.XamarinForms into a new iOS project.

Severity Code Description Project File Line Suppression State Warning The project 'Gjallarhorn.Bindable.XamarinForms' cannot be referenced. The referenced project is targeted to a different framework family (.NETFramework) ElmInspiredOneXF.iOS

@bigjonroberts
Copy link
Author

My next step is to try building this exclusively on Visual Studio for Mac. But it's a side project and I might not get to that for a few days.

@@ -0,0 +1,76 @@
using UIKit;
using Foundation;
using Gjallarhorn.Bindable.Framework;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the android app, there is a reference to Gjallarhorn.XamarinForms.
I was experimenting with just trying to use Gjallarhorn.Bindable without the XamarinForms...

public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
global::Xamarin.Forms.Forms.Init();
//var info = Framework.CreateApplicationInfo(Program.applicationCore, new MainPage());
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines were copied from the Android app shell project.
Unsure the correct interface to load into an iOS application.
is there an interface that can bind to UIApplication somehow?

@bigjonroberts
Copy link
Author

Perhaps I can try .NetStandard from #14
Would this lead in the same direction as this?
https://dontpaniclabs.com/blog/post/2017/10/17/targeting-net-standard-xamarin-forms-shared-libraries/

@bigjonroberts
Copy link
Author

bigjonroberts commented Feb 10, 2018

I loaded up the net standard branch from mtnrqb and rebased-renamed my branch over that.
I'm able to get everything else working, except the iOS build. I made sure that I am able to get a .netstandard iOS build loaded onto my phone. I just created an empty app in VS for Mac and configured all the profiles/certs/etc. So that is isolated. It's not an issue with building/deploying any old netstandard app.

When I get the error under VS for Mac, it provides a link to here to submit a bug report about this assembly:
https://developer.xamarin.com/guides/ios/troubleshooting/mtouch-errors/#MT2102

/Users/dad/work/Gjallarhorn.Bindable/samples/ElmInspiredOne/iOS/bin/iPhone/Debug/ElmInspiredOneXF.iOS2.iOS.exe  
    MTOUCH : error MT2102: Error processing the method 'System.String Gjallarhorn.XamarinForms.DynParameterInfo::get_Name()' in the assembly 'Gjallarhorn.Bindable.XamarinForms.dll': Object reference not set to an instance of an object
Done building target "_CompileToNative" in project "ElmInspiredOneXF.iOS2.iOS.csproj" -- FAILED.

Done building project "ElmInspiredOneXF.iOS2.iOS.csproj" -- FAILED.

Build FAILED.

/Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(2003,5): warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190.
MTOUCH : error MT2102: Error processing the method 'System.String Gjallarhorn.XamarinForms.DynParameterInfo::get_Name()' in the assembly 'Gjallarhorn.Bindable.XamarinForms.dll': Object reference not set to an instance of an object
    1 Warning(s)
    1 Error(s)

Time Elapsed 00:00:18.45

---------------------- Done ----------------------

Build: 1 error, 1 warning

@bigjonroberts
Copy link
Author

bigjonroberts commented Feb 12, 2018

I was able to get it working using the new Xamarin .NetStandard templates that were introduced last year. I've shared in a separate repo (https://github.com/bigjonroberts/Conduit) and you can decide what to do from there. After decision is made, I'll help roll in the new demo.
I still need to go back and make adjustments to the Android app in this repo, but I never had any trouble getting android apps working, so I don't think it will be an issue.
Plus side - this is pure FSharp code now, the Driod and iOS apps are fsproj, too, not csproj.
Cons:

  • may need to adjust some of the existing demo code to make this work.
  • if we make this adjustment, will it be compatible with older VS versions? does this matter?

@mtnrbq
Copy link
Contributor

mtnrbq commented Feb 12, 2018

@bigjonroberts - awesome work

@ReedCopsey
Copy link
Owner

@bigjonroberts I'd see if rebasing this and seeing how well it works with the latest VS and the updated templates.

Got the official core library project out for NS 2 now, so hopefully this will work better. I'm fine losing support for old VS versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants