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:
I can see the detail.
Why it happended? help~
Alternative plan
It maybe not a best Solution, but it works:
just declare the Custom Type in Objective-C++ file, not in Objective-C file.
like this:
extern "C" {
class CustomType {
public:
bool haveEmail;
...
};
}
And it works.

Alternative plan
It maybe not a best Solution, but it works:
just declare the Custom Type in
Objective-C++file, not inObjective-Cfile.like this:
And it works.