Problem when binding iOS library

anhkhoaanhkhoa USMember ✭✭

Hi everyone,

I'm trying to bind native iOS library into Xamarin project using "iOS Binddings Library", however there is an issue that I can't run my application.
The binding project and main project can build successfully but the app can't be launched when I deploy on a real device.

My app is blinking several times and stops without going to main screen. The strange thing is: if I don't use any function or property of this binding project, my application can be launched, otherwise it can't (even this function or property isn't called yet).

I still stuck on this issue, I haven't found any reason for it.
I hope that you guys can help me to find what is the problem there.

You can find my sample in the attachment and looking forward to receiving your help.

Thank in advance!

Regards,

Sample.zip 1016.3K
Tagged:

Best Answers

Answers

  • anhkhoaanhkhoa USMember ✭✭

    Thank for your support,

    I changed the Swift library to Objective C library and ported to Xamarin again. However there was the same behavior.
    The log was:

    warning MT1003: Could not kill the application 'My app'. You may have to kill the application manually.

    I still can't figure out what is the reason. Can you guys take a look my new project (with objective C library) and help me to find problem?
    I appreciate you guys a lot.

    Thank in advance!

  • JavierHolcmanJavierHolcman ARMember ✭✭

    I am on the same point here. Any help?

  • anhkhoaanhkhoa USMember ✭✭

    Hi Javier,

    I could solve this problem but I'm not sure this can help you. You can try.
    It looks like the framework you are binding is a dynamic library not a static library so binding to it is different.

    You can see what type of library, dynamic or static, a binary is using a Terminal command "file", in this case, open Teminal on your Mac and enter the following command:
    file /path/to/[your SDK]
    (replace /path/to with the actual path. Or you can open Terminal, type "file" (no quotes) and then drag the [Your SDK] file to the Terminal window and the path will be entered automatically.)

    I got the following after executing the above command for my library:
    /Users/jongoldberger/Downloads/Sample/Library/WirelessRegistrySDK.a: Mach-O universal binary with 4 architectures
    /Users/jongoldberger/Downloads/Sample/Library/WirelessRegistrySDK.a (for architecture i386): Mach-O dynamically linked shared library i386
    /Users/jongoldberger/Downloads/Sample/Library/WirelessRegistrySDK.a (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
    /Users/jongoldberger/Downloads/Sample/Library/WirelessRegistrySDK.a (for architecture armv7): Mach-O dynamically linked shared library arm
    /Users/jongoldberger/Downloads/Sample/Library/WirelessRegistrySDK.a (for architecture arm64): Mach-O 64-bit dynamically linked shared library

    Please see the following for more info:
    http://forums.xamarin.com/discussion/53262/plan-for-binding-to-dynamic-ios-libraries-from-xamarin
    https://developer.xamarin.com/releases/ios/xamarin.ios_9/xamarin.ios_9.0/#Support_for_Embedded_Frameworks
    https://github.com/xamarin/embedded-frameworks

    Can you try the method of using an embedded framework noted in the above posts and example and see if you are able to move forward?

  • JavierHolcmanJavierHolcman ARMember ✭✭

    I was trying to implement a binding project to a swift framework (with the obj-c headers). The problem I has was exactly the same you described before. I fixed it adding the package Xamarin.Swift22.Support to the main project.

  • anhkhoaanhkhoa USMember ✭✭

    Yeah,
    Nice to hear that,

    Congratulation!

Sign In or Register to comment.