Tóm tắt
Đây là ứng dụng đầu tiên của tôi mà tôi đang cố gắng thực hiện với Xamarin. Tôi đang học từ ví dụ Hello World, iPhone
. Khi tôi nhấp vào nút của tôi, ứng dụng bị treo và tôi không thể hiểu tại sao.Ứng dụng iOS bị treo khi tôi nhấp vào UIButton của tôi - không thể tìm ra lý do tại sao?
Chi tiết
Tôi đã có một đơn giản UIViewController
với một đơn UIButton
. Tôi đã tạo ra một cửa hàng vì vậy khi tôi bấm vào nút, tôi làm điều gì đó.
Khi tôi kết nối nút của TouchUpInside event
của nút, ứng dụng gặp sự cố khi tôi nhấp vào nút. Khi tôi loại bỏ sự kiện có dây (nhưng ổ cắm vẫn còn tồn tại), ứng dụng không sụp đổ khi tôi nhấp vào nút. (Tất nhiên, không có gì xảy ra bởi vì không có gì được kết nối).
Điều gì giết chết tôi là tôi không biết có gì sai và sử dụng thông tin gỡ lỗi, tôi không thể hiểu được! Tôi đã làm C# code trong nhiều năm nay nhưng chỉ mới bắt đầu ở Xam hơi khác một chút, đặc biệt là khi báo cáo sự cố là .. cũng .. thiếu bất kỳ thông tin nào :(Tôi đoán tôi có thể có một số cài đặt được đánh dấu (ví dụ: không có thông tin debug?)
Vì vậy, đây là một số mã ...
AuthenticationViewController
tập tin .h
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface AuthenticationViewController : UIViewController {
UIButton *_Google;
}
@property (nonatomic, retain) IBOutlet UIButton *Google;
@end
.m tập tin
#import "AuthenticationViewController.h"
@implementation AuthenticationViewController
@synthesize Google = _Google;
@end
nhà thiết kế tập tin
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;
}
}
}
}
và cuối cùng, nộp
cs tôi
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++;
};
}
}
}
Oh - và bắn tiền ... các (thiếu) dấu vết đổ/ngăn xếp ngăn xếp
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,intptr,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.
=================================================================
Tôi bị kẹt và không biết cách tiếp tục? Tôi đã dành một số giờ thử nhiều thứ khác nhau để làm việc này.
Hơn nữa, here's a video showing the error (vui lòng chọn phiên bản 720p).
và đây là số solution, zipped up.
Tôi sẽ đánh giá cao bất kỳ trợ giúp nào -> và không nói: tại đây, đã được khắc phục. nhưng .. bạn không làm được điều này và điều đó .. và bạn cần phải làm những việc đó để xxxx hoạt động.
Bất kỳ đề xuất nào, vui lòng?
Sự cố có xảy ra khi bạn chạy ứng dụng mà không gỡ lỗi không? –
Có. nó cũng xảy ra. –