Farseer Physics Engine not working on iPhone?

I want to port a Windows Phone 8 game to iOS, but I have some trouble with Farseer Physics Engine.
I get this error message in the following line:

world = new World(new Vector2(0, 1));
The type `Microsoft.Xna.Framework.Vector2’ is defined in an assembly that is not referenced.

What is wrong? The code works perfectly in my Windows Phone 8 project. But in Xamarin, I always get this error message.

You can find my project on dropbox: Project

It sounds like the reference to MonoGame in the Farseer project needs to be updated to use the iOS version.

How can I do that? It’s my first iOS project.

How can I integrate Farseer Physics in a Xamarin iOS project? Does someone know how to do that?

You have to download the source code for Farseer, and either use Monogame to compile it to an iOS library you can use, or if you’re using VS 2015 you should be able to just copy the files from the Farseer project to a new shared project for your game which you reference from your iOS project. I have done that for my Win10 & Android project, all nice and easy.

I use VS 2015 but it’s not working. I get many error messages :cry:
I created a MonoGame iOS project and a shared project. I added the files from the Farseer source code to my shared project and added a reference from the MonoGame iOS project to the shared project.
You can find my project on dropbox: project
What is wrong with my project? How can I use Farseer on iOS?
I want to create a game that runs on Windows Phone and iPhone.

Ahh, you’ve just added the CSPROJ files. What you need to do is open the Farseer Physics Monogame solution, copy the source folders and class files as-is into the new project, it should look like this:

Obviously, the folders should contain the same structure and content as the Farseer Physics Monogame solution, but only the classes and folders, not the rest of the stuff.

Also, seems like your Monogame for iOS reference is wrong, you might need to delete the reference and re-add it (or re-add the NuGet package).

Give it a go and let me know if you get stuck.

I get this error message:
The type or namespace name ‘DebugView’ does not exist in the namespace ‘FarseerPhysics’ (are you missing an assembly reference?)
What is wrong? I copied all the files from Farseer Physics MonoGame to my shared project and I created a new reference from Monogame for iOS to the shared project.
In addition, should I rename the class “DebugViewBase.cs” to “DebugView.cs”?

My project: https://www.dropbox.com/s/e070lsnm0sqxq84/Game5.rar?dl=0

If that’s your only error (looks like it is), just delete the using statement.

Otherwise, you’ll have to do the same thing with the Farseer Physics DebugView project, create a new SharedProject, copy all folders/files in, and reference it from your main project. I haven’t done this with my game though, so I’m not 100% sure it’s that straight forward. Theoretically it should be :slightly_smiling: