Unity building problem for Windows Phone
在使用 Unity 輸出 Windows Phone 專案的時候遇到幾個類似於下面的錯誤
Currently there will be errors like the following when building Windows Phone project in Unity.
method `System.Int32 System.String::Compare(System.String,System.String,System.Boolean)` doesn't exist in target framework.因為 Windows Phone 提供的 API 並不完整,遇到這種錯誤的時候解法有幾個
The reason is that some of the .NET API are not provided by Windows Phone. The solutions for the error are:
- 改寫程式,拿掉那些沒有提供的 API,改用其他有提供的 API 達到一樣的功能
Rewrite the code to remove those un-supported API and use other supported API instead. - 一樣改寫程式,實作那些沒有提供的 API ,編譯出 DLL 檔放進 Unity Project
Implement those un-supported API, compile as DLL and put it in the Unity Project. Use the DLL functions instead.
I chose Solution one for the un-supported API String.Compare(String, String, Boolean) and List.ConvertAll. Windows Phone API provided String.Compare(String, String, StringComparison) which can be used to replace String.Compare(String, String, Boolean), as for List.ConvertAll I just converted each item of the list with List.ForEach.
當然直接把有用到的部份拿掉也是一種 workaround。
Of course you can just remove the un-supported code, if it's not necessary, as a workaround.
No comments:
Post a Comment