Static library from Xamarin binding return polutet object for real device but the good one for simulator

Stefan Stevanovic 21 Reputation points
2021-04-23T11:37:55.443+00:00

I have created binding for iOS static library, which has linkwith.cs like this:
[assembly: LinkWith ("libAppoxeeInappUniversal.a", LinkTarget.ArmV7 | LinkTarget.ArmV7s | LinkTarget.Simulator|LinkTarget.Arm64, SmartLink = false, ForceLoad = true, Frameworks = "WebKit")]

I must to set SmartLink to false, otherwise it returns null for singleton value from the static library.
Then when I trigger one API call ( from the binding/static library) on simulator, it returns array of objects with all properties set up well:
90802-screenshot-2021-04-23-at-132329.png

Message object has properties content, messageId, status, subject, ...

When I fire same API call when app is on real device, I got same array of messages, but there is none of previous mentioned properties:
90710-screenshot-2021-04-23-at-132945.png

The Framework which builds static library is written also by my team and me, and there is no any logic which will divide simulator and real device. It just returns list of messages.

When i run lipo -info for static lib I got output:
Architectures in the fat file: libAppoxeeSDKUniversal.a are: armv7 i386 x86_64 arm64

Can anyone point me somewhere? Why is this happening?

Developer technologies .NET Xamarin
{count} votes

Accepted answer
  1. Saverio Roncolini 81 Reputation points
    2021-04-28T10:51:52.17+00:00

    Hi StefanStevanovic,

    to fix the problem you should change DidReceiveInBoxMessages method signature in ApiDefinition.cs from

    void DidReceiveInBoxMessages([NullAllowed] NSObject[] messages);

    to
    void DidReceiveInBoxMessages([NullAllowed] APXInBoxMessage[] messages);

    Regards

    Saverio Roncolini

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.