EXC_BAD_ACCESS when call custom Class in Unity call iOS


I try to build Unity to iOS.

And I have a method call from Unity to iOS,

I can see the details when I hover my mouse on the variable, but when I call the variable, It throw EXC_BAD_ACCESS.

Why? Any suggestion.

Here is the code:

Unity call:

// call
saveLoginConfig(config);


[DllImport("__Internal")]
private static extern void saveLoginConfig(LinLoginConfig config);

Unity object

    [Serializable]
    public struct LinLoginConfig
    {
        public bool haveEmail;
    }

ios bridge

extern void saveLoginConfig(const LinLoginConfig &config) {
    NSLog(@"saveLoginConfig haveEmail0"); // line1
    NSLog(@"saveLoginConfig haveEmail1:%@", &config); // line2
}

ios object

@interface LinLoginConfig : NSObject

@property(nonatomic, assign) bool haveEmail;

@end

At breakpoint:
enter image description here
I can see the detail.

throw:
enter image description here

Why it happended? help~

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img