开发者

Protobuf-net v2 alpha compile dll problem for iphone [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 11 years ago.

We're developing a cross-platform online game using unity3d(monotouch) engine (C#), and we use protobuf-net (thanks to Marc Gravell) as protocol. As we know, reflection does not work on iOS. It is not allowed by Apple to have code generated dynamically. We checked Marc's blog (http://marcgravell.blogspot.com/), and found the early protobuf-net v2(though it's not completed yet) may avoid reflection problem.

we made some test and try to pre-compile serialize code into dll file, howerver, when we run it on ios , we got the following message.

>

     System.IO.FileNotFoundException has been thrown
>     “Could not load file or assembly “DataBuilder , Version=0.0.0.0 , 
> Culture = neutrual , PublicKeyToken =
> null ”” or one of its dependencies.”

here is our compile dll code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ProtoBuf;
using ProtoBuf.Meta;
using Data;
using System.Reflection;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var bb = TypeModel.Create();
            bb.Add(typeof(Customer), true);
            bb.Compile("DataBuilder", "databuilder.dll");
        }
    }
}   

here is our test code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Data;
using System.IO;
using ProtoBuf;
using ProtoBuf.Meta;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var create开发者_StackOverflow社区r = new DataBuilder();  // that's it

            var dd = new Data.Customer();
            dd.Name = "Hellow World";
            dd.CustomerId = "1232";
            MemoryStream mm = new MemoryStream();
            creater.Serialize(mm, dd);
            mm.Seek(0, SeekOrigin.Begin);
            Data.Customer c = (Data.Customer)creater.Deserialize(mm, null, typeof(Data.Customer));
            Console.WriteLine(c.Name);
        }
    }
}

We compiled dll under Windows enviornment(compact framework .net 3.5), maybe it didn't work on monotouch.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜