Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The 'isWrapper' argument to the [Register] attribute must be correct for models #4065

Closed
rolfbjarne opened this issue May 9, 2018 · 5 comments
Assignees
Labels
iOS Issues affecting iOS macOS Issues affecting macOS support The issue is related to support
Milestone

Comments

@rolfbjarne
Copy link
Member

rolfbjarne commented May 9, 2018

This is a breaking change in d15-7 that exposes an old bug in our binding generator, causing build failures (this is an example of the CorePlot component, which hasn't been updated since early 2015):

clang : error : linker command failed with exit code 1 (use -v to see invocation)
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: CPTAnimationDelegate. The symbol '_OBJC_CLASS_$_CPTAnimationDelegate' could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: CPTAxisDelegate. The symbol '_OBJC_CLASS_$_CPTAxisDelegate' could not be found in any of the libraries or frameworks linked with your application.
MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: CPTBarPlotDataSource. The symbol '_OBJC_CLASS_$_CPTBarPlotDataSource' could not be found in any of the libraries or frameworks linked with your application.
[...]
MTOUCH : error MT5202: Native linking failed. Please review the build log.

Old versions of the binding generator would generate the following code:

[Model]
[Protocol]
[Register ("CPTAnimationDelegate", true)]
public class CPTAnimationDelegate : NSObject, ICPTAnimationDelegate, INativeObject, IDisposable
{
}

The problem is the true argument to the [Register] attribute: it specifies that the managed class is wrapping an existing Objective-C class. For models (classes with the [Model] attribute) this is incorrect. At the time this did not cause any ill effects, because the value didn't change any behavior.

However, In our most recent release, d15-7, this changed, and now the value must be correct, otherwise the app will fail to build as mentioned above.

The binding generator was fixed in early 2015, which means that the problem only occurs with any binding libraries that haven't been updated since then (such as the CorePlot component).

The fix is to rebuild the binding project with a recent version of Xamarin.iOS (any version from the last two years would do). If the source code isn't available, there is also a command-line tool available that can fix the library.

Reference (fix): https://github.com/xamarin/maccore/commit/b9f39f537bb39fa69a1312be097f127901d7b652

@rolfbjarne rolfbjarne self-assigned this May 9, 2018
@rolfbjarne rolfbjarne changed the title Undefined symbols for architecture ...: "OBJC_CLASS$_...", referenced from: objc-class-ref in registrar.o The 'is_wrapper' argument to the [Register] attribute must be correct for models May 9, 2018
@dalexsoto dalexsoto added macOS Issues affecting macOS iOS Issues affecting iOS labels May 9, 2018
@dalexsoto dalexsoto added this to the Future milestone May 9, 2018
@rolfbjarne rolfbjarne changed the title The 'is_wrapper' argument to the [Register] attribute must be correct for models The 'isWrapper' argument to the [Register] attribute must be correct for models May 10, 2018
@rolfbjarne
Copy link
Member Author

Closing since this issue is purely informational.

@volcano619
Copy link

Is this issue still present ??

@rolfbjarne
Copy link
Member Author

@volcano619 if you run into this you need to fix the binding library that causes this problem, it's not something that will be fixed in Xamarin.iOS.

@volcano619
Copy link

The library is present ,has all the architectures and has the interfaces that it claims to be missing, tried adding [Protocol] annotation but that just seems to bypass the error
Am I missing something , and it was running fine before..
Any inputs would be helpfull

@rolfbjarne
Copy link
Member Author

@volcano619 if have the binding project and are building it, you're not running into this problem (which only happens if you're using an already built binding assembly that hasn't been rebuilt since 2015).

I suggest you file a new issue and describe your problem there, preferably attaching the binding project as well.

@ghost ghost locked as resolved and limited conversation to collaborators May 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Issues affecting iOS macOS Issues affecting macOS support The issue is related to support
Projects
None yet
Development

No branches or pull requests

4 participants