2

i found similar issues but none of them resolved my problem.

There are some viewcontrollers and working application.

I added one button to one of the viewcontrollers and binded a "sampleclick" action. there is nothing (no codes, no lines, just an empty method) in this action and application crashes with following blocks :

All output log :

(lldb)

and stack :

libobjc.A.dylib`objc_msgSend:
0x10ed08c:  movl   8(%esp), %ecx
0x10ed090:  movl   4(%esp), %eax
0x10ed094:  testl  %eax, %eax
0x10ed096:  je     0x10ed0e8                 ; objc_msgSend + 92
0x10ed098:  movl   (%eax), %edx
0x10ed09a:  pushl  %edi
0x10ed09b:  movl   8(%edx), %edi
0x10ed09e:  pushl  %esi
***0x10ed09f:  movl   (%edi), %esi   >>> crashes here with :Thread1:EXC_BAD_ACCESS*** (code=1,address: .....)
0x10ed0a1:  movl   %ecx, %edx
0x10ed0a3:  shrl   $2, %edx
0x10ed0a6:  andl   %esi, %edx
0x10ed0a8:  movl   8(%edi,%edx,4), %eax
0x10ed0ac:  testl  %eax, %eax
0x10ed0ae:  je     0x10ed0b9                 ; objc_msgSend + 45
0x10ed0b0:  cmpl   (%eax), %ecx
0x10ed0b2:  je     0x10ed0d0                 ; objc_msgSend + 68
0x10ed0b4:  addl   $1, %edx
0x10ed0b7:  jmp    0x10ed0a6                 ; objc_msgSend + 26
0x10ed0b9:  popl   %esi
0x10ed0ba:  popl   %edi
0x10ed0bb:  movl   4(%esp), %edx
0x10ed0bf:  movl   (%edx), %eax
0x10ed0c1:  jmp    0x10ed0d9                 ; objc_msgSend + 77
0x10ed0c3:  nopw   %cs:(%eax,%eax)
4

3 回答 3

5

One possible answer to your issue is that you are trying to send a message to a deallocated instance of an object.

Try looking for zoombies (press ⌘</kbd>⌥</kbd>R, select the Diagnostics tab and activate Enable Zombie Objects). Every released object will become an instance of NSZombie, which will log messages to the console if you ever try to access them instead of crashing.

Also, on ARM architecture (which concerns iOS), r0 should point towards the receiver of the message. You can try investigating this. It may yield useful informations. (use p/x $r0 command on the debugger. If you execute x/s $r1, you should get the selector name.)

Note:
If you are to debug crashes that occurs within objc_msgSend() then, I strongly recommend you to take a look at [objc explain]: So you crashed in objc_msgSend() on the Hamster Emporium archive. It contains valuable tips & tricks to get most informations out of the debugger as well as investigate why the crash occurred.

Edit: From the comments, but without the code, one can only guess that somewhere in your code an object (likely detailviewcontroller) registered for events but has been deallocated too soon. Hence the crash when sending the action. This is only a hint, but IMHO it is worth investigating in the debugger.

于 2013-04-20T20:06:04.030 回答
1

我知道了!!!!

我通过逐步删除每个操作和属性的整个应用程序来解决它,并找到了罪魁祸首:(也许可以帮助遇到同样问题的人)

detailsviewcontroller 是一个典型的 uiviewcontroller,通过以下代码打开:

    detailviewcontroller *vc = [[detailviewcontroller alloc] initWithNibName:@"detailviewcontroller" bundle:nil];
[self.view addSubview:vc.view];

我替换为以下代码(只是删除了detailviewcontroller word和*),问题得到解决:

    vc = [[detailviewcontroller alloc] initWithNibName:@"detailviewcontroller" bundle:nil];
[self.view addSubview:vc.view];

这也表明我应该更多地研究目标 ca 的声明;)

于 2013-04-21T17:07:37.700 回答
0

这是 .m 文件:

#import "detailviewcontroller.h"

@interface detailviewcontroller ()

@end

@implementation detailviewcontroller

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
    // Custom initialization
}
return self;
}

-(IBAction)denemecik:(id)sender
{
// there is no code here 
}

- (void)viewDidLoad
{
[super viewDidLoad];
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
//NSLog(@"memori warning aldım");
// Dispose of any resources that can be recreated.
}

这是.h文件:

#import <UIKit/UIKit.h>
@interface detailviewcontroller : UIViewController
{
}
-(IBAction)denemecik:(id)sender;
@end

和 xib 视图:视图上只有一个按钮,我只需单击它

于 2013-04-21T14:22:48.840 回答