I think I am having trouble loading the classes from a objc .a file. 
Is there anything I left out that needs doing to better connect the 
C# bindings with the .a file content and get the classes to load?



Short version:

I'm using MGSplitViewController and the separate relevant C# 
bindings, both from GitHub.
Built a dll for the bindings,
Built a .a for the objc code,
Made them both part of the project. The dll is also a reference. The 
.a has a build action of "Nothing".
Build from clean completes; run the app to see the exception show up 
right after the splash screen saying "The classes in the module 
cannot be loaded."



Detailed version:

I am attempting to use MGSplitViewController, an Objc project from 
GitHub. I've created a project that creates a static library of the 
classes I need. When I create a new version of the .a file I drag it 
into the MonoTouch project folder. I'm using gcc 4.2. (I'm taking a 
lot of my project file clues from the facebook ios sdk project.) The 
.a file is part of the project; I've changed the build action for 
this file to various different values to see if it affects the 
results, and it doesn't.

I have a set of C# bindings for MGSplitViewController from the 
mono-bindings package up on GitHub. I built a dll for the bindings, 
put that file in the project folder, and added the dll to the project 
as a reference. I modified this binding file once just to change the 
namespace to match the one used by the app.

I have defined a class MySplitViewController : MGSplitViewController 
in a file MySplitViewController.cs.

The main window xib refers to MySplitViewController. I haven't filled 
out the inheritance data using IB. I used to have this set up but 
removed that, thinking that IB may be in conflict somehow with the 
code in the rest of the project. (When I did have it set, the 
relevant xib.designer.cs file did not seem to generate the correct 
class hierarchy.)

I've added references to MySplitViewController in the main window 
xib.cs file in order to set up the master and detail panels. When I 
ask MonoDevelop to go find MGSplitViewController, it jumps right to 
the dll and shows the class.

For the Debug|iPhoneSimulator configuration, I have Default SDK, 4.0 
the min OS, and the Linker behavior set to "Link SDK assemblies 
only". Debugging is enabled, and the additional arguments are:

-v -v -v -v -v -gcc_flags "-L${ProjectDir} -framework CoreGraphics 
-framework UIKit -framework Foundation -force_load 
${ProjectDir}/libMGSplitView.a -lMGSplitView"

(I assumed -v are not unlike end parens in Lisp, use lots.)

I watch the well-hidden build process output under the Error pad; it 
doesn't mention having any issues with the above gcc flags when they 
show up in the build log.


Debugging the app under the simulator, it immediately catches an 
exception: System.Reflection.ReflectionTypeLoadException "The classes 
in the module cannot be loaded." It doesn't mention (anywhere I can 
find) the name of the classes or the module. (Are the names available 
anywhere?)

I assume it is failing to load the .a file content.

When I disable "Link SDK assemblies only" to "Don't Link" and then 
build and run, it is obvious that MySplitViewController is never 
properly initialized, excution exceptions when trying to do an 
assignment to the null ViewControllers array for the split view.


Thanks very much!

-Mike
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to