摘要
这是我试图用Xamarin制作的第一个应用程序.我正在学习Hello World,iPhone的例子.当我点击我的按钮时,应用程序崩溃,我无法弄清楚原因.
这是我试图用Xamarin制作的第一个应用程序.我正在学习Hello World,iPhone的例子.当我点击我的按钮时,应用程序崩溃,我无法弄清楚原因.
细节
我有一个简单的UIViewController和一个UIButton.我创建了一个插座,所以当我点击按钮时,我会做一些事情.
当我连接按钮的TouchUpInside事件时,当我点击按钮时应用程序崩溃.当我删除有线连接事件(但插座仍然存在)时,单击按钮时应用程序不会崩溃. (当然,没有任何事情发生,因为没有任何连线).
杀了我的是我不知道出了什么问题并且使用了调试信息,我无法弄明白!我一直在做c#代码多年,但刚开始在Xam有点不同,特别是当崩溃报告是……好……缺乏任何信息:(我猜我可能有一些设置勾选(例如.没有调试信息?)
所以这里有一些代码……
AuthenticationViewController
.h文件
#import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface AuthenticationViewController : UIViewController { UIButton *_Google; } @property (nonatomic,retain) IBOutlet UIButton *Google; @end
.m文件
#import "AuthenticationViewController.h" @implementation AuthenticationViewController @synthesize Google = _Google; @end
设计师档案
using MonoTouch.Foundation; using System.CodeDom.Compiler; namespace Foo.Client.iPhone { [Register ("AuthenticationViewController")] partial class AuthenticationViewController { [Outlet] MonoTouch.UIKit.UIButton Google { get; set; } void ReleaseDesignerOutlets () { if (Google != null) { Google.Dispose (); Google = null; } } } }
最后,我的
.cs文件
using System; using System.Drawing; using MonoTouch.Foundation; using MonoTouch.UIKit; namespace Foo.Client.iPhone { public partial class AuthenticationViewController : UIViewController { public int xxx = 0; public event EventHandler OnAuthenticationCompleted; public AuthenticationViewController() : base ("AuthenticationViewController",null) { } public override void DidReceiveMemoryWarning() { // Releases the view if it doesn't have a superview. base.DidReceiveMemoryWarning(); // Release any cached data,images,etc that aren't in use. } public override void ViewDidLoad() { base.ViewDidLoad(); Google.TouchUpInside += (sender,e) => { xxx++; }; } } }
哦 – 和金钱射击……(缺乏)崩溃转储/堆栈跟踪
2013-10-25 21:37:13.785 FooClientiPhone[8852:1403] MonoTouch: Socket error while connecting to MonoDevelop on 127.0.0.1:10000: Connection refused mono-rt: Stacktrace: mono-rt: at <unknown> <0xffffffff> mono-rt: at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x0009f,0xffffffff> mono-rt: at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38 mono-rt: at Foo.Client.iPhone.Application.Main (string[]) [0x00008] in /Users/PureKrome/Documents/Mac Projects/Foo iOS Client/Code/Foo.Client.iPhone/Main.cs:16 mono-rt: at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr) <IL 0x00050,0xffffffff> mono-rt: Native stacktrace: mono-rt: ================================================================= Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application. =================================================================
我被困住了,不知道怎么继续?我已经花了好几个小时尝试各种各样的东西来实现这个目标.
此外,here’s a video showing the error(请选择720p版本).
我将不胜感激任何帮助 – >而不是说:这里是固定的.但是……你没有做到这一点……你需要做那些事情,所以xxxx有效.
有什么建议吗?