Search Unity

(SOLVED) Application crash with NotSupportedException

Discussion in 'iOS and tvOS' started by grifdrey, Jul 11, 2016.

  1. grifdrey

    grifdrey

    Joined:
    May 13, 2015
    Posts:
    11
    Hello. Our game works well in Unity Editor and Android, but when we build for IOS we can see this error in Xcode:
    Unhandled Exception: System.NotSupportedException: CodePage 1251 not supported at System.Text.GetEncoding()
    After that application quit. We are using the latest version of Unity and Xcode. Scripting Backend is IL2CPP. Can you help me?
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    @grifdrey

    You will probably need to copy the I18N.dll and I18N.West.dll files into your project directory manually so that they are available to the player. This answer has a good discussion about how to do this: http://answers.unity3d.com/questions/42955/codepage-1252-not-supported-works-in-editor-but-no.html
     
  3. grifdrey

    grifdrey

    Joined:
    May 13, 2015
    Posts:
    11
    Thank you for the reply. But i've already have this files in my project\Assets\Plugins folder. And application still crashing after Encoding.GetEncoding(1251).GetBytes("Some text"). This problem exist only in IOS version. In dll's settings value "Any platform" is checked. Maybe we need some special Compile flags for them?
     
    Last edited: Jul 12, 2016
    jean-noellevels3d likes this.
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    @grifdrey

    Make sure they are not being stripped before the build happens. You can use a link.xml to force the managed code stripper to preserve them. There are details here:

    http://docs.unity3d.com/Manual/iphone-playerSizeOptimization.html
     
  5. grifdrey

    grifdrey

    Joined:
    May 13, 2015
    Posts:
    11
    Error exists with any value of Strip Engine Code from Unity build settings. And link.xml in Assets folder with
    <linker>
    <assembly fullname="System" preserve="all"/>
    </linker>
    didnt help. I18N.dll and I18N.West.dll are in Assets\Plugins folder.
     
  6. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    @grifdrey

    I think you want to change the link.xml to be

    <linker>
    <assembly fullname="I18N" preserve="all"/>
    <assembly fullname="I18N.West" preserve="all"/>
    </linker>

    So that it will preserve the localization assemblies. There might be some other problem, but I don't think that preserving System.dll (as you mentioned earlier) will impact this issue one way or another.
     
  7. grifdrey

    grifdrey

    Joined:
    May 13, 2015
    Posts:
    11
    Thank you, i'll try this.
     
  8. grifdrey

    grifdrey

    Joined:
    May 13, 2015
    Posts:
    11
    Solved! link.xml with your data works. Thank you
     
  9. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Excellent! I'm glad to hear that it works.
     
  10. jean-noellevels3d

    jean-noellevels3d

    Joined:
    Apr 24, 2017
    Posts:
    4
    I have the same pb but for HTML5 target, and your proposition does not resolve my issue :(

    EDIT : In fact, it works ! I had a mistake on the filename. It's "link.xml" and NOT "linker.xml"

    Thanks a lot ! :)
     
    Last edited: May 26, 2017
  11. KyleAceViral

    KyleAceViral

    Joined:
    Oct 8, 2019
    Posts:
    4
    Hey guys, followed the steps for this and I'm still getting the error on my Crashlytics, should I be seeing the dlls in XCode? Because I can't, I've added all the possible I18N varients aswell and added them to the link.xml respectively
     
    OleksandrMartysh likes this.
  12. OleksandrMartysh

    OleksandrMartysh

    Joined:
    Dec 13, 2015
    Posts:
    25
    The same here.
    Copying only that 2 files (I18N & I18N.West) didn't help me. I had to copy all 6 files.