2011-03-29 3 views
1

정말 엉망입니다. 나는 그것과 레이블에 ScrollView가있는 View를 가지고 있습니다. 이 경우 스크롤이 제대로 작동합니다. clickFoo 액션을 생성하고, 수십 개의 UIViews처럼 Partial 코드를 넣었지만, 이제는 끔찍한 스택 추적 (아래 참조)이 발생합니다. 버튼과 액션을 제거하지만 UIScrollView의 Scrolling 이벤트에 대한 핸들러를 넣으면 같은 결과를 얻습니다. 왜 이런 일이 일어나고 있는지 모르겠다. 이것은 정말로, 정말 간단한 물건입니다.MonoTouch - ScrollView + 모든 이벤트 = 충돌

레코드의 경우 scrollview는 100x40이고 레이블과 버튼은 scrollview에 없습니다.

나는이 내있는 viewDidLoad에서 다음 코드

public partial class Testing : UIViewController 
{ 
    #region Constructors 

    // The IntPtr and initWithCoder constructors are required for items that need 
    // to be able to be created from a xib rather than from managed code 

    public Testing (IntPtr handle) : base(handle) 
    { 
     Initialize(); 
    } 

    [Export("initWithCoder:")] 
    public Testing (NSCoder coder) : base(coder) 
    { 
     Initialize(); 
    } 

    public Testing() : base("Testing", null) 
    { 
     Initialize(); 
    } 

    void Initialize() 
    { 
    } 

    #endregion 
    List<UIImageView> _imageViews; 

    public override void ViewDidLoad() 
    { 
     base.ViewDidLoad(); 

     _imageViews = new List<UIImageView>(); 

     UIButton btnNumber; 
     /*    btnNumber = new UIButton(new RectangleF(new PointF(32f*x,0f), new SizeF(31f,31f))); 
      btnNumber.SetImage(UIImage.FromBundle("images/7.png"), UIControlState.Normal); 
      btnNumber.SetImage(UIImage.FromBundle("images/7.png"), UIControlState.Highlighted);*/ 
     UIImageView imgView; 

     scrollView.ContentSize = new System.Drawing.SizeF(400, 31); 

     for (int x=0;x < 30; x++) {   
      imgView = new UIImageView(new RectangleF(new PointF(32f*x,0f), new SizeF(31f,31f))); 
      imgView.Image = UIImage.FromBundle("images/7.png"); 
      scrollView.AddSubview(imgView); 
      _imageViews.Add(imgView); 
     } 

    } 

    partial void clickFoo (UIButton sender) 
    { 
     lblInfo.Text = "Clicked"; 
    } 

} [ Code pasted in updated @12:07pm EDT ] 

나는 다음과 같은 예외 스택 수 (내가 찾을 고전적인, 매우 실망 "이봐, 뭔가 이벤트 관련 어딘가 잘못이다")

Stacktrace: 

    at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <0x00004> 
    at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <0x00004> 
    at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x00038] in /Users/plasma/Source/iphone-3/monotouch/UIKit/UIApplication.cs:26 
    at MonoTouch.UIKit.UIApplication.Main (string[]) [0x00000] in /Users/plasma/Source/iphone-3/monotouch/UIKit/UIApplication.cs:31 
    at ZenVelopes.Application.Main (string[]) [0x00000] in /Users/drisszouak/Projects/ZenVelopes/ZenVelopes/Main.cs:14 
    at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x0001d, 0x00043> 

Native stacktrace: 

    0 ZenVelopes       0x000be9db mono_handle_native_sigsegv + 343 
    1 ZenVelopes       0x0000e7a6 mono_sigsegv_signal_handler + 313 
    2 libSystem.B.dylib     0x918db46b _sigtramp + 43 
    3 ???         0xffffffff 0x0 + 4294967295 
    4 UIKit        0x01c721b5 -[UIControl sendAction:to:forEvent:] + 67 
    5 UIKit        0x01c74647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527 
    6 UIKit        0x01c731f4 -[UIControl touchesEnded:withEvent:] + 458 
    7 UIKit        0x01c080d1 -[UIWindow _sendTouchesForEvent:] + 567 
    8 UIKit        0x01be937a -[UIApplication sendEvent:] + 447 
    9 UIKit        0x01bee732 _UIApplicationHandleEvent + 7576 
    10 GraphicsServices     0x03eb9a36 PurpleEventCallback + 1550 
    11 CoreFoundation      0x00dfb064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52 
    12 CoreFoundation      0x00d5b6f7 __CFRunLoopDoSource1 + 215 
    13 CoreFoundation      0x00d58983 __CFRunLoopRun + 979 
    14 CoreFoundation      0x00d58240 CFRunLoopRunSpecific + 208 
    15 CoreFoundation      0x00d58161 CFRunLoopRunInMode + 97 
    16 GraphicsServices     0x03eb8268 GSEventRunModal + 217 
    17 GraphicsServices     0x03eb832d GSEventRun + 115 
    18 UIKit        0x01bf242e UIApplicationMain + 1160 
    19 ???         0x09e28c41 0x0 + 165841985 
    20 ???         0x09e28b7a 0x0 + 165841786 
    21 ???         0x09e2857d 0x0 + 165840253 
    22 ???         0x09e284b9 0x0 + 165840057 
    23 ???         0x09e28514 0x0 + 165840148 
    24 ZenVelopes       0x0000e56a mono_jit_runtime_invoke + 1360 
    25 ZenVelopes       0x001c961b mono_runtime_invoke + 137 
    26 ZenVelopes       0x001cb2d7 mono_runtime_exec_main + 714 
    27 ZenVelopes       0x001cabfd mono_runtime_run_main + 812 
    28 ZenVelopes       0x00095354 mono_jit_exec + 200 
    29 ZenVelopes       0x0027d299 main + 3494 
    30 ZenVelopes       0x00003009 _start + 208 
    31 ZenVelopes       0x00002f38 start + 40 

Debug info from gdb: 

warning: .o file "/Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmonotouch.a(monotouch-glue.x86.o)" more recent than executable timestamp in "/Users/drisszouak/Library/Application Support/iPhone Simulator/4.2/Applications/F902A6B1-4BA7-4BBE-B9D0-E5E4FE33A55A/ZenVelopes.app/ZenVelopes" 
warning: Could not open OSO file /Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmonotouch.a(monotouch-glue.x86.o) to scan for pubtypes for objfile /Users/drisszouak/Library/Application Support/iPhone Simulator/4.2/Applications/F902A6B1-4BA7-4BBE-B9D0-E5E4FE33A55A/ZenVelopes.app/ZenVelopes 
warning: .o file "/Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmonotouch.a(monotouch-x86.double-abi-stret-trampoline.o)" more recent than executable timestamp in "/Users/drisszouak/Library/Application Support/iPhone Simulator/4.2/Applications/F902A6B1-4BA7-4BBE-B9D0-E5E4FE33A55A/ZenVelopes.app/ZenVelopes" 
warning: Could not open OSO file /Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmonotouch.a(monotouch-x86.double-abi-stret-trampoline.o) to scan for pubtypes for objfile /Users/drisszouak/Library/Application Support/iPhone Simulator/4.2/Applications/F902A6B1-4BA7-4BBE-B9D0-E5E4FE33A55A/ZenVelopes.app/ZenVelopes 
warning: .o file "/Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmonotouch.a(gc.x86.o)" more recent than executable timestamp in "/Users/drisszouak/Library/Application Support/iPhone Simulator/4.2/Applications/F902A6B1-4BA7-4BBE-B9D0-E5E4FE33A55A/ZenVelopes.app/ZenVelopes" 
warning: Could not open OSO file /Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmonotouch.a(gc.x86.o) to scan for pubtypes for objfile /Users/drisszouak/Library/Application Support/iPhone Simulator/4.2/Applications/F902A6B1-4BA7-4BBE-B9D0-E5E4FE33A55A/ZenVelopes.app/ZenVelopes 
warning: .o file "/Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmonotouch.a(zlib-helper.x86.o)" more recent than executable timestamp in "/Users/drisszouak/Library/Application Support/iPhone Simulator/4.2/Applications/F902A6B1-4BA7-4BBE-B9D0-E5E4FE33A55A/ZenVelopes.app/ZenVelopes" 
warning: Could not open OSO file /Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmonotouch.a(zlib-helper.x86.o) to scan for pubtypes for objfile /Users/drisszouak/Library/Application Support/iPhone Simulator/4.2/Applications/F902A6B1-4BA7-4BBE-B9D0-E5E4FE33A55A/ZenVelopes.app/ZenVelopes 
warning: Could not find object file "/var/folders/Ny/NyElTwhDGD8kZMqIEeLGXE+++TI/-Tmp-//ccvRqNHg.o" - no debug information available for "template.m". 

warning: .o file "/Developer/usr/lib/gcc/i686-apple-darwin10/4.2.1/libgcc.a(_divdi3.o)" more recent than executable timestamp in "/Users/drisszouak/Library/Application Support/iPhone Simulator/4.2/Applications/F902A6B1-4BA7-4BBE-B9D0-E5E4FE33A55A/ZenVelopes.app/ZenVelopes" 
warning: Could not open OSO file /Developer/usr/lib/gcc/i686-apple-darwin10/4.2.1/libgcc.a(_divdi3.o) to scan for pubtypes for objfile /Users/drisszouak/Library/Application Support/iPhone Simulator/4.2/Applications/F902A6B1-4BA7-4BBE-B9D0-E5E4FE33A55A/ZenVelopes.app/ZenVelopes 
warning: .o file "/Developer/usr/lib/gcc/i686-apple-darwin10/4.2.1/libgcc.a(_moddi3.o)" more recent than executable timestamp in "/Users/drisszouak/Library/Application Support/iPhone Simulator/4.2/Applications/F902A6B1-4BA7-4BBE-B9D0-E5E4FE33A55A/ZenVelopes.app/ZenVelopes" 
warning: Could not open OSO file /Developer/usr/lib/gcc/i686-apple-darwin10/4.2.1/libgcc.a(_moddi3.o) to scan for pubtypes for objfile /Users/drisszouak/Library/Application Support/iPhone Simulator/4.2/Applications/F902A6B1-4BA7-4BBE-B9D0-E5E4FE33A55A/ZenVelopes.app/ZenVelopes 
warning: .o file "/Developer/usr/lib/gcc/i686-apple-darwin10/4.2.1/libgcc.a(_udivdi3.o)" more recent than executable timestamp in "/Users/drisszouak/Library/Application Support/iPhone Simulator/4.2/Applications/F902A6B1-4BA7-4BBE-B9D0-E5E4FE33A55A/ZenVelopes.app/ZenVelopes" 
warning: Could not open OSO file /Developer/usr/lib/gcc/i686-apple-darwin10/4.2.1/libgcc.a(_udivdi3.o) to scan for pubtypes for objfile /Users/drisszouak/Library/Application Support/iPhone Simulator/4.2/Applications/F902A6B1-4BA7-4BBE-B9D0-E5E4FE33A55A/ZenVelopes.app/ZenVelopes 
warning: .o file "/Developer/usr/lib/gcc/i686-apple-darwin10/4.2.1/libgcc.a(_umoddi3.o)" more recent than executable timestamp in "/Users/drisszouak/Library/Application Support/iPhone Simulator/4.2/Applications/F902A6B1-4BA7-4BBE-B9D0-E5E4FE33A55A/ZenVelopes.app/ZenVelopes" 
warning: Could not open OSO file /Developer/usr/lib/gcc/i686-apple-darwin10/4.2.1/libgcc.a(_umoddi3.o) to scan for pubtypes for objfile /Users/drisszouak/Library/Application Support/iPhone Simulator/4.2/Applications/F902A6B1-4BA7-4BBE-B9D0-E5E4FE33A55A/ZenVelopes.app/ZenVelopes 
Error connecting stdout and stderr (127.0.0.1:10001) 
warning: .o file "/Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmonotouch.a(monotouch-glue.x86.o)" more recent than executable timestamp in "/Users/drisszouak/Library/Application Support/iPhone Simulator/4.2/Applications/F902A6B1-4BA7-4BBE-B9D0-E5E4FE33A55A/ZenVelopes.app/ZenVelopes" 
warning: Couldn't open object file '/Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmonotouch.a(monotouch-glue.x86.o)' 
Attaching to process 3839. 
Reading symbols for shared libraries . done 
Reading symbols for shared libraries ...................................................................................................................... done 
0x91880459 in read$UNIX2003() 
    7 "WebThread"      0x918750fa in mach_msg_trap() 
    6         0x918a30a6 in __semwait_signal() 
    5         0x91875136 in semaphore_wait_trap() 
    4         0x918750fa in mach_msg_trap() 
    3         0x9189aa12 in __workq_kernreturn() 
    2 "com.apple.libdispatch-manager" 0x9189b982 in kevent() 
* 1 "com.apple.main-thread"   0x91880459 in read$UNIX2003() 

Thread 7 (process 3839): 
#0 0x918750fa in mach_msg_trap() 
#1 0x91875867 in mach_msg() 
#2 0x00dfb4a6 in __CFRunLoopServiceMachPort() 
#3 0x00d58874 in __CFRunLoopRun() 
#4 0x00d58240 in CFRunLoopRunSpecific() 
#5 0x00d58161 in CFRunLoopRunInMode() 
#6 0x04f7e423 in RunWebThread() 
#7 0x918a285d in _pthread_start() 
#8 0x918a26e2 in thread_start() 

Thread 6 (process 3839): 
#0 0x918a30a6 in __semwait_signal() 
#1 0x918ceee5 in nanosleep$UNIX2003() 
#2 0x918cee23 in usleep$UNIX2003() 
#3 0x002774e0 in monotouch_pump_gc() 
#4 0x918a285d in _pthread_start() 
#5 0x918a26e2 in thread_start() 

Thread 5 (process 3839): 
#0 0x91875136 in semaphore_wait_trap() 
#1 0x0015b189 in finalizer_thread (unused=0x0) at ../../../../mono/metadata/gc.c:1026 
#2 0x00203836 in start_wrapper (data=0x7b172e0) at ../../../../mono/metadata/threads.c:661 
#3 0x00244c76 in thread_start_routine (args=0x8034a34) at ../../../../mono/io-layer/wthreads.c:286 
#4 0x002746eb in GC_start_routine (arg=0x6ff8f60) at ../../../libgc/pthread_support.c:1390 
#5 0x918a285d in _pthread_start() 
#6 0x918a26e2 in thread_start() 

Thread 4 (process 3839): 
#0 0x918750fa in mach_msg_trap() 
#1 0x91875867 in mach_msg() 
#2 0x0011cfb2 in mach_exception_thread (arg=0x0) at ../../../../mono/mini/mini-darwin.c:138 
#3 0x918a285d in _pthread_start() 
#4 0x918a26e2 in thread_start() 

Thread 3 (process 3839): 
#0 0x9189aa12 in __workq_kernreturn() 
#1 0x9189afa8 in _pthread_wqthread() 
#2 0x9189abc6 in start_wqthread() 

Thread 2 (process 3839): 
#0 0x9189b982 in kevent() 
#1 0x9189c09c in _dispatch_mgr_invoke() 
#2 0x9189b559 in _dispatch_queue_invoke() 
#3 0x9189b2fe in _dispatch_worker_thread2() 
#4 0x9189ad81 in _pthread_wqthread() 
#5 0x9189abc6 in start_wqthread() 

Thread 1 (process 3839): 
#0 0x91880459 in read$UNIX2003() 
#1 0x000beb8b in mono_handle_native_sigsegv (signal=11, ctx=0xbfffd294) at ../../../../mono/mini/mini-exceptions.c:1826 
#2 0x0000e7a6 in mono_sigsegv_signal_handler (_dummy=10, info=0xbfffd254, context=0xbfffd294) at ../../../../mono/mini/mini.c:4846 
#3 <signal handler called> 
#4 0x028d8a67 in objc_msgSend() 
#5 0x0cbabd70 in ??() 
#6 0x01c721b5 in -[UIControl sendAction:to:forEvent:]() 
#7 0x01c74647 in -[UIControl(Internal) _sendActionsForEvents:withEvent:]() 
#8 0x01c731f4 in -[UIControl touchesEnded:withEvent:]() 
#9 0x01c080d1 in -[UIWindow _sendTouchesForEvent:]() 
#10 0x01be937a in -[UIApplication sendEvent:]() 
#11 0x01bee732 in _UIApplicationHandleEvent() 
#12 0x03eb9a36 in PurpleEventCallback() 
#13 0x00dfb064 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__() 
#14 0x00d5b6f7 in __CFRunLoopDoSource1() 
#15 0x00d58983 in __CFRunLoopRun() 
#16 0x00d58240 in CFRunLoopRunSpecific() 
#17 0x00d58161 in CFRunLoopRunInMode() 
#18 0x03eb8268 in GSEventRunModal() 
#19 0x03eb832d in GSEventRun() 
#20 0x01bf242e in UIApplicationMain() 
#21 0x09e28c41 in ??() 
#22 0x09e28b7a in ??() 
#23 0x09e2857d in ??() 
#24 0x09e284b9 in ??() 
#25 0x09e28514 in ??() 
#26 0x0000e56a in mono_jit_runtime_invoke (method=0x818564c, obj=0x0, params=0xbfffed6c, exc=0x0) at ../../../../mono/mini/mini.c:4733 
#27 0x001c961b in mono_runtime_invoke (method=0x818564c, obj=0x0, params=0xbfffed6c, exc=0x0) at ../../../../mono/metadata/object.c:2615 
#28 0x001cb2d7 in mono_runtime_exec_main (method=0x818564c, args=0x9e857f0, exc=0x0) at ../../../../mono/metadata/object.c:3581 
#29 0x001cabfd in mono_runtime_run_main (method=0x818564c, argc=0, argv=0xbfffeea4, exc=0x0) at ../../../../mono/metadata/object.c:3355 
#30 0x00095354 in mono_jit_exec (domain=0x6f91e58, assembly=0x6e1ce80, argc=1, argv=0xbfffeea0) at ../../../../mono/mini/driver.c:1094 
#31 0x0027d299 in main() 

================================================================= 
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. 
================================================================= 


Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object 
    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) [0x00038] in /Users/plasma/Source/iphone-3/monotouch/UIKit/UIApplication.cs:26 
    at MonoTouch.UIKit.UIApplication.Main (System.String[] args) [0x00000] in /Users/plasma/Source/iphone-3/monotouch/UIKit/UIApplication.cs:31 
    at ZenVelopes.Application.Main (System.String[] args) [0x00000] in /Users/drisszouak/Projects/ZenVelopes/ZenVelopes/Main.cs:14 

답변

2

게시자가 게시 한 컨트롤러 스 니펫 (snippet)이 수집 된 것으로 보이는 액션 메시지를 보내고있는 대상 중 하나가 무엇인지 정확히 알려주는 데 충분한 정보를 제공하지 못했습니다.

+0

수집 할 수있는 내용이 표시되지 않습니다. UIViewController의 속성으로 List 을 추가했지만 아무 것도 변경하지 않습니다. 이 문제는 모든 이벤트가 발생할 때만 발생합니다. '컨트롤러 스 니펫'을 말하면 UIViewController를 의미합니까? 그는 수집하지 않습니다. –

+0

내 대답에 언급했듯이, 이것은 정확히 무슨 일이 일어나고 있는지, 나는 단지 당신의 프로젝트 코드의 2 %에서 어디로 말할 수 없습니다. –

+0

방금 ​​보여준 코드를 전체 부분 클래스로 업데이트했습니다. Main.cs 콘텐츠도 필요합니까? 위의 Testing 클래스를 인스턴스화하여 SubView로 추가하는 것뿐입니다. –