开发者

Problem loading Assemblies in MonoTouch Project

I am building a Monotouch (trial) 4.0.3. project. It compiles with the warning:

Warning: Library 'loader.dll' missing in app bundle, cannot extract content

All of the other dlls are successfully bundled during build, and this one was working before. After compiling with the warning, it crashes on load at runtime (on the simulator) with a segmentation fault when it fails to load the assembly.

I have searched for this warning and I haven't been abl开发者_JAVA技巧e to find any references to it. Does anyone know why the assembly is not being added to the app package?


It sounds like the linker is removing the loader.dll because it thinks nothing uses it. Try setting the project's linker setting to "link sdk only".


mhutch is correct, the linker is opportunistically pruning out the library. However, the default linker setting is not to link anything, so his solution will only work in the rare case that you're linking all assemblies (which you don't want to do with MonoTouch because references to the SDK should never be embedded).

The workaround is to just new up an instance of something in the library you want to use, from inside the calling assembly.

using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MyLibrary;

namespace MyApp
{
    public class Application
    {
        static void Main(string [] args)
        {
            new MyLibrary.DontPruneMeBro();

            UIApplication.Main(args, null, "AppDelegate");
        }
    }
}

As an aside, I don't know what iOS developers do, since this behavior would make run-time access to satellite libraries impossible.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜