MonoTouch解决方案包括两个项目。
本机ObjC库需要包含核心数据模型文件(.momd)。我已将它添加到Test App的项目中。
但是应用程序因以下错误而崩溃:
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 CombinedControllerApp.MainController.<ViewDidLoad>m__2 (System.Object , System.EventArgs ) [0x0003d] in /Users/mahmood1/Documents/Projects/TouchNote-Prototype/CombinedControllerApp/MainController.cs:96
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 CombinedControllerApp.Application.Main (System.String[] args) [0x00000] in /Users/mahmood1/Documents/Projects/TouchNote-Prototype/CombinedControllerApp/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 CombinedControllerApp.MainController.<ViewDidLoad>m__2 (System.Object , System.EventArgs ) [0x0003d] in /Users/mahmood1/Documents/Projects/TouchNote-Prototype/CombinedControllerApp/MainController.cs:96
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 CombinedControllerApp.Application.Main (System.String[] args) [0x00000] in /Users/mahmood1/Documents/Projects/TouchNote-Prototype/CombinedControllerApp/Main.cs:17
如何将此需要的CoreData模型文件添加到测试应用程序中,以便它对本机库可见?
谢谢!
答案 0 :(得分:2)
根据我的评论:
将大多数此类文件添加到Build Action
Content
的项目中将解决此问题。