I made a binding from a objective-c framework, it is working correctly but when I try to link my Xamarin.iOS project (Link Framework SDKs Only), I get this error
MTOUCH: Error MT5211: Native linking failed, undefined Objective-C
class: GLKView. The symbol '_OBJC_CLASS_$_GLKView' could not be found
in any of the libraries or frameworks linked with your application.
(MT5211)
In the microsoft documentation, says to add the [Protocol] attribute to the binding project.
I tried to add the attribute in the ApiDefinition.cs, first on top of the class and then before all methods and interfaces the classe have, with no success.
Link for the github repo
What am I doing wrong ?
I have try the same steps as you did , and downloaded the project you provided.It works on my VS for Mac.So ,I suggest you can creat a new blank bind libaray and copy the code into it then build it again.
I have uploaded my project to my gitHub.you can download it and have a try.
Demo
Related
I've been attempting to make grpc work (ssl http2) on Xamarin Forms and after some pain I managed to get it to work on Android using Grpc.Core. However I couldn't get iOS to compile. Working through this problem I was trying to get anything grpc related to work on iOS, and eventually found the grpc experimental xamarin demo, HelloworldXamarin. Found here:
https://github.com/grpc/grpc/tree/master/examples/csharp/HelloworldXamarin
I downloaded the solution, but when I try to compile it I get the following errors:
Error Text:
Native linking failed, undefined symbol: operator delete(void*). Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
Native linking failed. Please review the build log and the user flags provided to gcc: -LC:/g/examples/csharp/HelloworldXamarin/packages/Grpc.Core.2.23.0/build/Xamarin.iOS10/../../native/ios/universal -lgrpc_csharp_ext -force_load C:/g/examples/csharp/HelloworldXamarin/packages/Grpc.Core.2.23.0/build/Xamarin.iOS10/../../native/ios/universal/libgrpc_csharp_ext.a -LC:/g/examples/csharp/HelloworldXamarin/packages/Grpc.Core.2.23.0/build/Xamarin.iOS10/../../native/ios/universal -lgrpc -force_load C:/g/examples/csharp/HelloworldXamarin/packages/Grpc.Core.2.23.0/build/Xamarin.iOS10/../../native/ios/universal/libgrpc.a
linker command failed with exit code 1 (use -v to see invocation)
For the warning regarding not being able to find libgrpc_csharp_ext.a, I verified that the file was there.
There appears to be some issue with native linking, which I am very unfamiliar with. I'm using nearly the latest Visual Studio (well, 16.5.3), a mac build host with latest OS and XCode updated to latest. Didn't make any changes to the files pulled from git. I only just started working with Xamarin iOS this week, so everything should be in a fairly "default" state.
What could be wrong with my setup/system that makes this not work? I understand that this is an experimental feature still, but I can't tell if I've done something stupid or if there's been some change in something (like XCode? or it needing VS 2017?) that makes this no longer work? Is anyone else able to get this example to compile?
I've also tried newer versions of the grpc nuget packages and that only resulted in more errors.
Ultimately I'm trying to get latest Grpc.Core to work in iOS on Xamarin.Forms, though I have very little experience working with iOS. If there are issues with the latest versions of XCode/Visual Studio/Grpc.Core that are causing this, I'm willing to try to work through them, if someone can point me in the right direction.
It is not at all related to your versions or something that you did or didn't do.
First for some theory:
If someone wants to use Objective-C libraries or CocoaPods packages in their Xamarin project, they will need to create a binding library for this. Take it as some sort of a "bridge" between the native implementation and the later exposed C# code that you can use. You can learn more about the binding from the official documentation here and more specifically here.
To sum up the info - after the bindings have been created, you see a .lib or .a file. This is exactly what they have done - exposed some native code into the libgrpc_csharp_ext.a. Unfortunately, there are some bindings that are not correct. This is exactly what you are seeing here - the aftermath of an incorrect binding.
Looking a bit into the project I got to the following conclusions:
There is an open issue from May 2019 about this - https://github.com/grpc/grpc/issues/19172
Unfortunately, the issue is still active and there is no movement there.
I have confirmed that after version 1.21 (incl.) the build is not working. For now, you can downgrade to version 1.20.1 (last known to work). I have successfully built the solution with it. Please review the changelog and release notes for this specific version (if any) so that you know if it will fit your needs.
Basically, you have 2 options:
Downgrade to the last good version in order to use it;
If you want to use the latest version either wait for the issue to be fixed, or fork the repo and help with the fixing.
If you want to see their build script and help fix the issue, you can start from here.
Another useful resource is this video from the official Xamarin channel.
I have a project which is use XCardView for a while.(I've already distributed the app to the app store.)
I updated both VS and XCode to the latest version.
Now when I execute my project in emulator everything works fine.
However when I tried to compile it to device, the operation fails with 3 errors:
1:
Error: linker command failed with exit code 1 (use -v to see invocation)
2:
Error MT5211: Native linking failed, undefined Objective-C class: ZLSwipeableViewDelegate. The symbol '_OBJC_CLASS_$_ZLSwipeableViewDelegate' could not be found in any of the libraries or frameworks linked with your application. (MT5211)
3:
Error MT5202: Native linking failed. Please review the build log. (MT5202)
I've read MT5211 link for the errors but I have no clue with how to solve it since I don't have the source code of XCardView library and in the log I don't find any interesting information...
BTW, I didn't change my project settings at all.
Is there any idea on a way to solve this problem?
Thanks in advance :)
Edit 1:
I didn't change any project settings except adding new classes files.
Here is my project conf:
Edit 2:
XCardView was a Xamarin Component. Since the component store is no longer available the entire component can be found here
Right-click on the ios solution, you will see iOS build option there you can set the linker property to Link From SDK only.
I've been looking at different options for providing auto generated API Documentation and Swagger seems to be up there.
However when trying this out for the first time I'm getting exceptions on start up.
Running Visual Studio 2013.
Create new Web API project.
Using Package Manager, run:
Install-Package Swagger.Net & Install-Packager Swagger.Net.UI
Making sure we've enable the XML documentation we get this exception:
Method 'GetDocumentation' in type 'Swagger.Net.XmlCommentDocumentationProvider'
from assembly 'Swagger.Net, Version=0.5.1.0, Culture=neutral, PublicKeyToken=null'
does not have an implementation.
Does anyone else know of a step we are missing? We found & followed this:
https://github.com/Swagger-Net/Swagger.Net/wiki
https://github.com/Swagger-Net/Swagger.Net/blob/master/README.md
Swagger doesn't support .NET 4.5 - Had to get the source code out from git and modify it to work with 4.5.
Right click the project and set the target framework in there
I have made a library for use with mvc that generates the documentation for you based on attributes. It may be what your looking for.
MVC3: https://www.nuget.org/packages/SwaggerAPIDocumentation/
MVC4: https://www.nuget.org/packages/SwaggerAPIDocumentation.Mvc4/
MVC5: https://www.nuget.org/packages/SwaggerAPIDocumentation.Mvc5/
MVC5.1: https://www.nuget.org/packages/SwaggerAPIDocumentation.Mvc51/
There is dcoumentation in the repository on github just click the project site link. Hope this helps
Try using Swashbuckle.
Based on Swagger as far as I know and it worked first time for me...
https://github.com/domaindrivendev/Swashbuckle
MonoTouch Binding refers to my Static Library, which uses FacebookSDK.
Сhain projects:
MonoTouch App -> MonoTouch Binding -> My Static Library -> FacebookSDK
When you add interfaces ApiDefinition, arise errors associated with FacebookSDK how to solve this problem? Maybe someone has already encountered this problem?
Error MT5211: Native linking failed, undefined Objective-C class:
_OBJC_CLASS_$_FBFriendPickerViewController. If '_OBJC_CLASS_$_FBFriendPickerViewController' 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. (MT5211)
Remove reference of current the Facebook SDK framework and add the Facebook SDK again by drag and drop it in framework folder.
This will add Facebook SDK path automatically.
i'm trying to wrap D3D11 calls in an API ive been developing.
Ive made a C++/CX component library that i'm trying to use in C#. This is simple and straightforward if the C++/CX component and C# project are in the SAME solution, everything will work fine...
...but if I create my C++/CX API component in its OWN solution then create a second C# Metro App solution and add my C++/CX component "project" to it and then have my C# Metro App reference the C++/CX component project I get runtime errors when trying to use public enums that were declared in C++.
Here is the public enum class error that my C# app cant seem to link to.
"Could not find Windows Runtime type
'Reign.Video.D3D11.FeatureLevels'."
This is rly frustrating as I can't seem to get my C++/CX "API" stuff to link correctly in a C# app for TESTING. How are you suppose to productively test an API made in C++ on metro?? You can't link a C++/CX component to a C# project unless there in the same solution and if you try to link the C++/CX project to the C# solution and link it from there you get runtime errors...
EDIT: Here is a download link of a demo showing my issue: Download
Windows Runtime requires that all types must be found in a namespace that matches the name of the containing .winmd file. In the demo you linked, your generated winmd is named ExternalWindowsRuntimeComponentProject.winmd but your non-working class is found in the Reign.Video.D3D11 namespace. This is not permitted by WinRT and the .NET type loader will fail to find types that are not in an associated namespace.
The solution here is to make sure the FeatureLevels enum is in a winmd named either Reign.winmd, Reign.Video.winmd, or Reign.Video.D3D11.winmd.