Can not use System.drawing.common in Mono.Android and Xamarin.ios - xamarin.android

I am using System.drawing.common in my project, and it worked fine in .net core.
Now I am trying to use System.drawing.common in Mono.Android project and Xamarin.ios project.
Some problem occured:
1, I create a Mono.Android lib project, and install System.drawing.common with NuGet. It seems to be successful, but after installing, I can not find System.drawing.common in the "reference" list. I tryed to use "System.Drawing.Bitmap", but can not find Bitmap class.
2, I checked the package folder, such as "\packages\System.Drawing.Common.4.5.0-preview2-26406-04\lib". In the "netstandard2.0" folder, there is a DLL. In "MonoAndroid10" folder, there is a 0KB file named ".".
So, how can I use System.drawing.common in Mono.Android and Xamarin.ios?

According to this Issue, it seems you need to get copy System.Drawing.Common.dll manually to the output folder.
Or you could try to update your VS.

As I understand it, Xamarin/Android is not supported yet. I went through the process of porting my rendering code to netstandard 2.0, using System.Drawing.Common, and manually copied the dll to my app folder. Finally the exception I got from System.Drawing.Common was "PlatformNotSupported".
From discussions over at the netstandard/netcore dev forums it seems that a fix is scheduled for netstandard 3.0.

Related

How to construct a Swift Package that links to a local (not system) library?

I must have read over a dozen posts on possible techniques to link a local library into my Swift Package. Specifically, my package depends on libturbojpeg.a, which most users won't have installed anywhere. Even if they did install it (there is a DMG), I'd have to go through hoops to make sure I was linking in the correct version. I finally found a post in the Swift Forums that basically says you can't do it now.
It appears that the only way to link it now is using .linkerSettings(LinkerSetting.unsafeFlags(..., but if you use that your package can't be managed by Xcode (see above link, and I even tried it and verified it cannot be used).
Is there some kind of workaround that allows me to distribute my Swift Package with the library?
In my Package, I created a directory "Libraries" and added my library there.
I discovered that Xcode 11 places included Swift Packages in a specific location in the Derived Folders directory. This means that it is possible to tell Xcode where to find it during the link phase.
My Package has these instructions in it for users:
1) Add the Package using Xcode->File->Packages with the URL of https://github.com/dhoerl/
2) Open the app's Project Build Phases, and from the Package shown in the left file pane, drag the Libraries/.a file into the link phase. It will appear just above the that should already be there
3) In Application Build settings, under library search paths, add:
"$(BUILD_DIR)/../../SourcePackages/checkouts//Libraries"
Build and run! VoĆ­la - works like a charm!
Note: obviously this is somewhat fragile, Xcode 12 could change how packages are managed, but its possible by then that the Swift Package Manager will support linking of local libraries (its mentioned in the above link.)

How to access the file in the main bundle of project with cocoapod installed

I was trying to follow AppCoda tutorial about the Lottie framework but I couldn't access the file in bundle. It shows this image:
File can't be found. And also if I check the content, it's not there as shown in this image
But the file is copied in the directory if we check in Finder.
I notice that projects without cocoapod work fine, I can access the resources.
I have tried to create a new project, then install the framework using cocoapod several times assuming maybe there was installation error or whatnot but I still don't know how to access the file.
I am using Xcode9beta6.
So I think this is my lack of knowledge of how to access the resources in cocoapod installed project. I have searched for the solution but couldn't find the same one. Please help. Thank you!

VS-MDA: Custom iOS-Framework in Plugin

we want to create a MobFox-Plugin for our hybrid apps. It is already running well in CLI-Cordova Apps, but it does not work in our hybrid apps, because it seems that the directory structure of the framework (the symbolic links between headers and version directory) is destroyed by Windows, where the framework is inside the plugin in the mda project. If I start a build, the header directory of is not recognized as a symbolic link, but as an ordinary executable textfile on the Mac.
This is how I include the framework in the plugin xml:
<framework src="libs/ios/MobFox.framework" custom="true"/>
I also tried to copy the MobFox.framework to the SDK Frameworks Folder and reference it like the standard system libraries (which work well):
<framework src="MobFox.framework" />
But this also fails, though the Framework is now included correctly in Xcode. But the compiler now says that it cannot find the MobFox.h-class, this is how it's included:
#import <MobFox/MobFox.h>
So I really think that the problem is that Windows cannot handle the symbolic links inside the .framework File. Does anybody has a workaround or solution for this problem? Or an idea why my Workaround with placing the file in the Standard-Frameworks Folder does not work?
Any help would be highly appreciated.
Thanks
Same problem here - it appears that when the plugin is published to the cordova registry it loses the symbolic links inside the .Framework package that tell XCode where everything is.
They are maintained on git, so it is something in the plugman export/publish that is going wrong.
So for example
cordova plugin add https://github.com/uxcam/cordova-uxcam
will work for the plugin I am writing, but not
cordova plugin add com.uxcam.cordova.plugin
which is the published version.
If you delve down into the 'plugins' folder of the project you added it too and 'show package contents' on the com.uxcam.cordova.plugin file you can then get into 'src/ios'UXCam.framework' and see how it has messed up the symbolic links in the framework folder that should point at the Headers folder and a link the the library binary as well.
Reference: Cordova bug report here: https://issues.apache.org/jira/browse/CB-6092
Update: I've worked around the problem by manually putting files in the framework into the places they need to be. So now on the github project I reference above you can see that the framework library is directly in the UXCam.framework folder, and there is an explicit Headers folder that has the UXCam.h file in it. This works for a published plugin now.
Not an ideal solution and every time I update the framework I'll have to fix the layout again, but works for now until I can find the proper place to report the problem.

Swift Xcode workspace, project unable to find a separate source code file (in Compile Sources)

I'm using Xcode 6.0.1.
The repo can be found at https://github.com/ippoippo/thornbird
You will need to create your own SpikeKeysForTesting.swift file, using the SpikeKeysForTesting.swift_example as a template.
Anyway, the main problem I am having is that I have source file located in a directory which I was intending to use as a common source directory.
It's a similar technique used by Moya (https://github.com/AshFurrow/Moya) and also documented here : http://www.swift-studies.com/blog/2014/6/30/creating-a-pure-swift-framework-for-both-ios-and-mac
However, when I try to build my ThornbirdFramework project inside the Workspace, the ThornbirdFrameworkTests class is unable to resolve the Thornbird class (as defined in ./thornbird/Thornbird.swift).
Any ideas?
Rebuilt everything, seems OK now.

xCode can't find header files in Unity3D project

I'm building an iOS app using unity3D. Everything goes ok until I try to build the solution. Unity builds the xCode project with 0 problems but then, when I try to build with xCode, I get several, all of them the same: "*.h not found".
The problem in this is that the headers don't exist in the project folder, but in the original-unity project folder they do exist.
I've seen a lot of similar problems around the web, but most of them relate to independent xCode projects, being the solution messing with the paths and so on... But with a project built by unity is it supposed to change that? When I go check them, they seem correct...
I've also seen that unity had a problem and by reinstalling it would fix the problem. Unfortunately it didn't...
Does anyone know what kind of problem is this? Should I change the build paths even though unity set them some way? Is it unity's fault?
Thank in advance
Native plugins need to be stored in special folder Plugins, for iOS it is Assets/Plugins/iOS. Citing from Unity - Building Plugins for iOS:
Automated plugin integration
Unity iOS supports automated plugin integration in a limited way. All files with extensions .a,.m,.mm,.c,.cpp located in the Assets/Plugins/iOS folder will be merged into the generated Xcode project automatically. However, merging is done by symlinking files from Assets/Plugins/iOS to the final destination, which might affect some workflows. The .h files are not included in the Xcode project tree, but they appear on the destination file system, thus allowing compilation of .m/.mm/.c/.cpp files.
Note: subfolders are currently not supported.
I marked the subfolders statement bold as I ran into trouble with this some time ago :)

Resources