Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin - can no longer debug on device -error MT5211

Until the most recent upgrade I could debug on a device. I now get the following errors:

Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_ZipArchiveDelegate", referenced from:
   objc-class-ref in registrar.armv7.o
  _OBJC_CLASS_$_MiniZip_ZipArchive_ZipArchive__ZipArchiveDelegate in registrar.armv7.o
"_OBJC_METACLASS_$_ZipArchiveDelegate", referenced from:
  _OBJC_METACLASS_$_MiniZip_ZipArchive_ZipArchive__ZipArchiveDelegate in registrar.armv7.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error MT5211: Native linking failed, undefined Objective-C class: _OBJC_CLASS_$_ZipArchiveDelegate. If '_OBJC_CLASS_$_ZipArchiveDelegate' is a protocol from a third-party binding, please check that it has the [Protocol] attribute in its api definition file, otherwise verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
error MT5210: Native linking failed, undefined symbol: _OBJC_METACLASS_$_ZipArchiveDelegate. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
error MT5202: Native linking failed. Please review the build log.

I've cleaned, and rebuilt but with no avail. Any ideas?

like image 227
Tanis Draven Avatar asked May 02 '14 14:05

Tanis Draven


2 Answers

It turns out this error is caused by the improved strictness of the new default static registrar:

  • http://docs.xamarin.com/releases/ios/xamarin.ios_7/xamarin.ios_7.2/#1
  • http://docs.xamarin.com/guides/ios/advanced_topics/registrar/#Protocols_must_have_the_Protocol_attribute

You can work around the problem temporarily by requesting that Xamarin.iOS use the legacy registrar. To do this, add "--registrar:legacy" under "Project Options -> iOS Build -> Additional mtouch arguments".

The components team has also contacted the authors of the ZipArchive component to let them know about the issues with the new registrar, but they have not yet replied. In case the they do not provide an update soon, you can look at transitioning to an open-source binding for the same library written by the Xamarin components team [1]. One caution with this binding is that the method and class names might be different from the ones in the ZipArchive component, and the namespaces are definitely different. So you will need to update the names in your app accordingly.

[1] https://github.com/mono/monotouch-bindings/tree/master/ZipArchive

like image 94
Brendan Zagaeski Avatar answered Nov 18 '22 06:11

Brendan Zagaeski


Having the exact same issue. But both on zipArchive and SDWebImage. Uninstalled-re-installed xamarin. Did not help.

Created a solution from scratch, added zipArchive and added to the using section. The project does not build for device. But building for simulator is fine.

Emailed Xamarin support for help.

like image 1
Chad Avatar answered Nov 18 '22 05:11

Chad