Brand New Xamarin Forms App Linking Issues

Brand new Xamarin Forms application with iOS platform project. Added LinkOS_Xamarin_SDK in forms project and iOS project (v1.1.75). Placed the following code in one of my page code behind:

 

sing System.Threading.Tasks;

using System.Text;

using System.Diagnostics;

using System;

using Xamarin.Forms;

using LinkOS.Plugin.Abstractions;

using LinkOS.Plugin;

 

 

namespace Printer

{

  public partial class PrinterPage : ContentPage

  {

  public PrinterPage()

  {

  InitializeComponent();

  }

 

  void Handle_Clicked(object sender, System.EventArgs e)

  {

Task.Run(async () =>

{

await Task.Delay(100);

var address = "AC:3F:A4:5B:1E:7E";

Print(address);

});

  }

 

IConnection connection;

 

private void Print(string address)

{

string zpl = "^XA^LL200^FO30,20^A0N,30,30^FDHello World^FS^XZ";

 

try

{

if ((connection == null) || (!connection.IsConnected))

{

connection = ConnectionBuilder.Current.Build("BT:" + address);

connection.Open();

}

 

}

catch (Exception e)

{

//if the device is unable to connect, an exception is thrown

Debug.WriteLine(e.ToString());

}

}

  }

}

 

When the application compiles against a real device in debug mode the following errors are thrown:

 

"_CGImageGetWidth", referenced from:

  -[GraphicsUtilCpcl printImage:atX:atY:withWidth:withHeight:andIsInsideFormat:error:] in libZSDK_API.a(GraphicsUtilCpcl.o)

  -[GraphicsUtilCpcl storeImage:withImage:withWidth:andWithHeight:error:] in libZSDK_API.a(GraphicsUtilCpcl.o)

  -[GraphicsUtilZpl printImage:atX:atY:withWidth:withHeight:andIsInsideFormat:error:] in libZSDK_API.a(GraphicsUtilZpl.o)

  -[GraphicsUtilZpl storeImage:withImage:withWidth:andWithHeight:error:] in libZSDK_API.a(GraphicsUtilZpl.o)

  "_OBJC_CLASS_$_EAAccessoryManager", referenced from:

  objc-class-ref in libZSDK_API.a(MfiBtPrinterConnection.o)

  "_OBJC_CLASS_$_EASession", referenced from:

  objc-class-ref in libZSDK_API.a(Zebra_EADSessionController.o)

  ld: symbol(s) not found for architecture arm64

  clang : error : linker command failed with exit code 1 (use -v to see invocation)

  

  MTOUCH : error MT5216: Native linking failed for '/Users/wesleyriley/Projects/InventoryManager/InventoryManager/InventoryManager.iOS/obj/iPhone/Debug/device-builds/ipad6.7-10.0.1/mtouch-cache/arm64/libzsdk_iosx.dll.dylib'. Please file a bug report at http://bugzilla.xamarin.com

Done building target "_CompileToNative" in project "InventoryManager.iOS.csproj" -- FAILED.

 

Done building project "InventoryManager.iOS.csproj" -- FAILED.

 

Build FAILED.

...

...

...

clang : error : linker command failed with exit code 1 (use -v to see invocation)

MTOUCH : error MT5216: Native linking failed for '/Users/wesleyriley/Projects/InventoryManager/InventoryManager/InventoryManager.iOS/obj/iPhone/Debug/device-builds/ipad6.7-10.0.1/mtouch-cache/arm64/libzsdk_iosx.dll.dylib'. Please file a bug report at http://bugzilla.xamarin.com

 

Note this error does not happen when running on a simulator. Unfortunately, I need a real device to test Bluetooth Zebra printing..

 

I am running the latest version of Xamarin and the latest version of Visual Studio. I have tried this in Visual Studio 2017 for Windows and VS 2017 for MAC with the same result.

 

Any help would be greatly appreciated.

Wesley Riley
@Here is a public repo with

@Here is a public repo with problem indicated in the original post:

https://github.com/rileybwesley/SampleFormsApp

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hi Wesley, Which version of

Hi Wesley, Which version of iOS?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Wesley Riley
iOS Version: 10.3.3

iOS Version: 10.3.3

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Wesley Riley
Same result on 10.0.1 as well

Same result on 10.0.1 as well...

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Wesley Riley
Hey Robin,I had one of my

Hey Robin,

I had one of my colleagues reproduce this using a fresh copy of VS, Xamarin, and the LinkOS SDK using the repo link above. Still, I am very surprised no one else has encountered the error....

Thanks,

Wes

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Wesley Riley
I am now able to compile.

I am now able to compile. However, it will only compile in Release configuration. Thank you.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hi Wesley,  I'm still trying

Hi Wesley,  I'm still trying to figure out why it won't compile in debug, but I'm glad you got it to work.  Happy Friday!

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments