Search Unity

MongoDB Unity game iOS Build Throw System.NotSupportedException

Discussion in 'iOS and tvOS' started by ctykaya, Apr 20, 2019.

  1. ctykaya

    ctykaya

    Joined:
    Sep 23, 2015
    Posts:
    12
    I am trying to implement MondoDB in my unity game. It works fine in both unity editor and android platforms but throw an exception on iOS device.

    I install the MongoDB drivers by using NuGet and change the API level to .Net 4. x. When API level is .Net 2 then all namespace gone and cannot use any MongoDB code in my solution. Any ideas ? How can I use MongoDB in iOS device ?
     
  2. doctorpangloss

    doctorpangloss

    Joined:
    Feb 20, 2013
    Posts:
    270
    It's pretty ambitious to try to use the official C# MongoDB driver. Since you didn't post what exactly was throwing, in the trace, you should probably learn how to enable stack traces for the exception. It will show you that there's a piece of network or platform code that isn't implemented on iOS, which is reasonable.

    It works fine on the other platforms because they are Mono platforms. You can't disable code stripping anymore, but you can try to learn how to use link.xml to control what libraries you reference.

    By the way, mongo supports third-party REST APIs pretty durably (https://docs.mongodb.com/ecosystem/tools/http-interfaces/) so you should probably use those. It will cut your binary size in half, fix your issues on iOS, and be more performant for actual cell phone use.