Patryk
Patryk

Reputation: 1

App crash only on iPhone Device and not in Simulator - Xamarin Binding project

I created iOS Binding Project with two static lib to SDK Payleven (github.com/payleven/mPOS-SDK-iOS). App crash only on iPhone Device and not in Simulator. On Simulator app works fine.

In "iOS Build" I set the same settings for iPhone and Simulator. The only difference is "Supported architecture:"

iPhone: ARMv7 + ARMv7s + ARM64

Simulator: i386 + x86_64

I try all configurations in "Linker behavior".

Without additional mtouch arguments in IOS Build I have 34 errors
http://pastebin.com/03S6P9DU

with arguments

-gcc_flags "-L${ProjectDir}/Soft.ePosPayleven/ -lPaylevenSDK -lAdyenToolkit -force_load ${ProjectDir}/Soft.ePosPayleven/libPaylevenSDK.a ${ProjectDir}/Soft.ePosPayleven/libAdyenToolkit.a" 

I have this exception http://pastebin.com/8eEMrU0n in class generated by xamarin in binding project.

[CompilerGenerated]
        [EditorBrowsable (EditorBrowsableState.Advanced)]
        [Export ("init")]
        public PLVPayleven () : base (NSObjectFlag.Empty)
        {
            IsDirectBinding = GetType ().Assembly == global::ApiDefinition.Messaging.this_assembly;
            if (IsDirectBinding) {
exception-->    InitializeHandle (global::ApiDefinition.Messaging.IntPtr_objc_msgSend (this.Handle, global::ObjCRuntime.Selector.GetHandle ("init")), "init");
            } else {
                InitializeHandle (global::ApiDefinition.Messaging.IntPtr_objc_msgSendSuper (this.SuperHandle, global::ObjCRuntime.Selector.GetHandle ("init")), "init");
            }
        }

libAdyenToolkit.linkwith.cs

[assembly: LinkWith ("libAdyenToolkit.a", LinkTarget.ArmV7 | LinkTarget.ArmV7s | LinkTarget.Simulator | LinkTarget.Simulator64 | LinkTarget.Arm64, SmartLink = true, ForceLoad = true, 
     Frameworks = "CoreFoundation CoreData CoreLocation ExternalAccessory SystemConfiguration UIKit Foundation", LinkerFlags = "-lz -lsqlite3", IsCxx = true)] 

libPaylevenSDK.linkwith.cs

[assembly: LinkWith ("libPaylevenSDK.a", LinkTarget.Simulator | LinkTarget.Simulator64 | LinkTarget.ArmV7 | LinkTarget.Arm64, SmartLink = true, ForceLoad = true, 
     Frameworks = "CoreFoundation CoreData CoreLocation ExternalAccessory SystemConfiguration UIKit Foundation", LinkerFlags = "-lz -lsqlite3", IsCxx = true)] 

Device: iPhone 5s

Xamarin Studio: 5.9.7 (build 9)

Tested on Simulators: 5, 5s, 6 with sdk 8.4 i 8.1

"lipo -info libPaylevenSDK.a" gives me: Architectures in the fat file: libPaylevenSDK.a are: i386 x86_64 armv7 arm64

and

"lipo -info libAdyenToolkit.a" : Architectures in the fat file: libAdyenToolkit.a are: i386 x86_64 armv7 armv7s arm64

Upvotes: 0

Views: 974

Answers (1)

Jauhenka
Jauhenka

Reputation: 162

As long as you have got an undefined symbol exception, you probably has your .a file built only for simulator. You can know it exactly if you run

nm %yourLibrary%.a | grep _SecCertificateCreateWithData

and find there only one line for one architecture.

Build one more library, for devices, and merge them with lipo like here: https://developer.xamarin.com/guides/ios/advanced_topics/native_interop/

Upvotes: 0

Related Questions