0

我在 monotouch 中绑定了第三方(red park sdk)。我通过使用monotouch绑定项目为red park dll创建了包装器,并在简单的应用程序中实现了dll。在分配委托时,应用程序崩溃。这是我分配代表的代码

rsc=new RscMgr();
            RscMgrDelegate del=new MyRedParkDelegate();

            System.Diagnostics.Debug.WriteLine("this"+del);
            rsc.SetDelegate(del);

我遇到的崩溃是

Incident Identifier: D4781D02-9D0A-427B-BD33-D867720E9CB6
CrashReporter Key:   ecaef65d635cbb77be4760eebfa4b05b6be49112
Hardware Model:      iPhone3,1
Process:         TestRedParkSDK [498]
Path:            /var/mobile/Applications/5574681C-8028-474D-B0AA-3C71B3C7EA39/TestRedParkSDK.app/TestRedParkSDK
Identifier:      TestRedParkSDK
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2012-07-12 15:09:48.635 +0530
OS Version:      iPhone OS 5.1.1 (9B206)
Report Version:  104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_PROTECTION_FAILURE at 0x2fd00ff8
Crashed Thread:  0

    Thread 0 name:  Dispatch queue: com.apple.main-thread
    Thread 0 Crashed:

0   CoreFoundation                  0x37391ca0 0x3737b000 + 93344
1   CoreFoundation                  0x373f99c8 0x3737b000 + 518600
2   CoreFoundation                  0x3737c848 0x3737b000 + 6216
3   CoreFoundation                  0x3737c13e 0x3737b000 + 4414
4   CoreFoundation                  0x37391792 0x3737b000 + 92050

362 TestRedParkSDK                  0x00020278 0x1000 + 127608

371 TestRedParkSDK                  0x00263da8 0x1000 + 2502056
372 TestRedParkSDK                  0x00020278 0x1000 + 127608
373 TestRedParkSDK                  0x000fd04c 0x1000 + 1032268
...

Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0   libsystem_kernel.dylib          0x315db3a8 0x315da000 + 5032
1   libdispatch.dylib               0x30560ea4 0x30554000 + 52900
2   libdispatch.dylib               0x30560bc2 0x30554000 + 52162

Thread 2:
0   libsystem_kernel.dylib          0x315ebcd4 0x315da000 + 72916
1   libsystem_c.dylib               0x33ca3f36 0x33c9b000 + 36662
2   libsystem_c.dylib               0x33ca3cc8 0x33c9b000 + 36040

Thread 3:
0   libsystem_kernel.dylib          0x315eb470 0x315da000 + 70768
1   libsystem_c.dylib               0x33ca66d0 0x33c9b000 + 46800
2   TestRedParkSDK                  0x001ad9a4 0x1000 + 1755556
3   TestRedParkSDK                  0x001aeaec 0x1000 + 1759980
4   TestRedParkSDK                  0x001ae918 0x1000 + 1759512
5   TestRedParkSDK                  0x001ad71c 0x1000 + 1754908
6   TestRedParkSDK                  0x001b07e8 0x1000 + 1767400
7   Foundation                      0x37c1aa7a 0x37c0a000 + 68218
8   Foundation                      0x37cae58a 0x37c0a000 + 673162
9   libsystem_c.dylib               0x33ca972e 0x33c9b000 + 59182
10  libsystem_c.dylib               0x33ca95e8 0x33c9b000 + 58856

Thread 4:
0   libsystem_kernel.dylib          0x315ebcd4 0x315da000 + 72916
1   libsystem_c.dylib               0x33ca3f36 0x33c9b000 + 36662
2   libsystem_c.dylib               0x33ca3cc8 0x33c9b000 + 36040

Thread 5:
0   libsystem_kernel.dylib          0x315db054 0x315da000 + 4180
1   TestRedParkSDK                  0x00250590 0x1000 + 2422160
2   TestRedParkSDK                  0x001f3a72 0x1000 + 2042482
3   TestRedParkSDK                  0x0023ae72 0x1000 + 2334322
4   TestRedParkSDK                  0x0024bf8a 0x1000 + 2404234
5   TestRedParkSDK                  0x0025dd74 0x1000 + 2477428
6   libsystem_c.dylib               0x33ca972e 0x33c9b000 + 59182
7   libsystem_c.dylib               0x33ca95e8 0x33c9b000 + 58856

Thread 6 name:  WebThread
Thread 6:
0   libsystem_kernel.dylib          0x315db004 0x315da000 + 4100
1   libsystem_kernel.dylib          0x315db1fa 0x315da000 + 4602
2   CoreFoundation                  0x374083ec 0x3737b000 + 578540
3   CoreFoundation                  0x37407124 0x3737b000 + 573732
4   CoreFoundation                  0x3738a49e 0x3737b000 + 62622
5   CoreFoundation                  0x3738a366 0x3737b000 + 62310
6   WebCore                         0x32d33c9c 0x32c8a000 + 695452
7   libsystem_c.dylib               0x33ca972e 0x33c9b000 + 59182
8   libsystem_c.dylib               0x33ca95e8 0x33c9b000 + 58856

Thread 0 crashed with ARM Thread State:
    r0: 0x00627970    r1: 0x00000004      r2: 0x00000000      r3: 0xfefefeff
    r4: 0x00627970    r5: 0x00000002      r6: 0x3fa4bc60      r7: 0x2fd01010
    r8: 0x3fa4cc58    r9: 0x00000002     r10: 0x006555a0     r11: 0x2fd014c0
    ip: 0x00627970    sp: 0x2fd01004      lr: 0x373f99cf      pc: 0x37391ca0
  cpsr: 0x40000030




Kindly help me.Thanks in advance
4

1 回答 1

2

保存RscMgrDelegate在类的成员变量中。

如果垃圾收集器能够收集它(它没有保存在一个一直存在的变量中),那么当它试图调用它时,Objective-C 将会崩溃。这更有可能发生在设备上,因为垃圾收集器运行得更加积极。

于 2012-07-12T12:16:19.773 回答