Binding 可能的捆绑包问题-无法使用nil模型创建NSPersistentStoreCoordinator

Binding 可能的捆绑包问题-无法使用nil模型创建NSPersistentStoreCoordinator,binding,xamarin.ios,monodevelop,nsbundle,aviary,Binding,Xamarin.ios,Monodevelop,Nsbundle,Aviary,我想将Objective-C库集成到Monotouch项目中。我使用“Monotouch Binding Project”模板进行此操作。 我已经建立了DLL(感谢聪明人!)这个项目是在模拟器上编译和运行的 但是,我无法显示主鸟舍视图和以下代码 this.afPhotoEditor = new AFPhotoEditorController(UIImage.FromFile("Images/site.jpg")); AFDelegate afDel

我想将Objective-C库集成到Monotouch项目中。我使用“Monotouch Binding Project”模板进行此操作。 我已经建立了DLL(感谢聪明人!)这个项目是在模拟器上编译和运行的

但是,我无法显示主鸟舍视图和以下代码

            this.afPhotoEditor = new AFPhotoEditorController(UIImage.FromFile("Images/site.jpg"));
            AFDelegate afDelegate = new AFDelegate(this);
            this.afPhotoEditor.Delegate = afDelegate;
            this.PresentModalViewController(this.afPhotoEditor, true);
返回错误:

Unhandled Exception: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: Cannot create an NSPersistentStoreCoordinator with a nil model
  at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSendSuper_IntPtr_bool (intptr,intptr,intptr,bool)
  at MonoTouch.UIKit.UIViewController.PresentModalViewController (MonoTouch.UIKit.UIViewController modalViewController, Boolean animated) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIViewController.g.cs:261 
  at TestAviary.FirstViewController.<ViewDidLoad>m__0 (System.Object , System.EventArgs ) [0x00028] in /Users/mahmood1/Projects/AviaryBinding/TestAviary/FirstViewController.cs:61 
  at MonoTouch.UIKit.UIControlEventProxy.Activated () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIControl.cs:30 
  at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29 
  at TestAviary.Application.Main (System.String[] args) [0x00000] in /Users/mahmood1/Projects/AviaryBinding/TestAviary/Main.cs:17 
[ERROR] FATAL UNHANDLED EXCEPTION: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: Cannot create an NSPersistentStoreCoordinator with a nil model
  at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSendSuper_IntPtr_bool (intptr,intptr,intptr,bool)
  at MonoTouch.UIKit.UIViewController.PresentModalViewController (MonoTouch.UIKit.UIViewController modalViewController, Boolean animated) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIViewController.g.cs:261 
  at TestAviary.FirstViewController.<ViewDidLoad>m__0 (System.Object , System.EventArgs ) [0x00028] in /Users/mahmood1/Projects/AviaryBinding/TestAviary/FirstViewController.cs:61 
  at MonoTouch.UIKit.UIControlEventProxy.Activated () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIControl.cs:30 
  at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29 
  at TestAviary.Application.Main (System.String[] args) [0x00000] in /Users/mahmood1/Projects/AviaryBinding/TestAviary/Main.cs:17 
所以我通过MonoDevelop中的“添加现有文件夹…”菜单项添加了这个包

它包括两个项目:

  • AviaryBinding(单触式绑定项目)
  • 遗嘱
谢谢大家!

每条评论:


使用
内容的
构建操作
将大多数这样的文件添加到项目中可以解决问题。

只是一个想法,您是否尝试打开捆绑包(我认为它是“显示内容”,我现在在windows上)并取出其中的所有资源?您可以将它们全部添加到MonoDevelop中的项目中。谢谢您的建议。是的,捆绑包打开,我可以从中获取所有文件。但我尝试了很多组合-没有运气。我不知道是什么导致了这个错误。也许Avariy iOS无法与MonoTouch集成。可能吗?或者MonoTouch可以绑定任何ObjC库?Shturman,你能和大家分享你(现在正在工作)的解决方案吗?有人为新的3.0版本创建绑定吗?根据新的应用商店规则,我们必须让它进入商店。发现3.0绑定:谢谢!在这里查看我的绑定以获得有效的解决方案。
4. Copy resources

Make sure AviarySDKResources.bundle is included in your target's "Copy Bundle Resources" build phase.