在设备上调试时 Ad Hoc iPhone SIGSEGV 崩溃模拟器工作

Ad Hoc iPhone SIGSEGV crash while Debug on device amp; simulator works(在设备上调试时 Ad Hoc iPhone SIGSEGV 崩溃模拟器工作)

本文介绍了在设备上调试时 Ad Hoc iPhone SIGSEGV 崩溃模拟器工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应用程序在我尝试登录后立即崩溃,所以这不是看门狗内存问题

App crashes immediately after I attempt to login so it can’t a be a watchdog memory issue

原因:_mh_execute_header尝试使用 ASIHTTPRequest 发出网络请求时应用程序崩溃.请求永远不会触及服务器.ASIHTTPRequest:我使用 -fno-objc-arc 从 ARC 中省略 ASIHTTPRequest.

Reason: _mh_execute_header App crashes upon attempting to make a network request using ASIHTTPRequest. Request never touches server. ASIHTTPRequest: I use -fno-objc-arc to omit ASIHTTPRequest from ARC.

我相信以下调用导致了我的问题,因为当我发出请求时,我的调用甚至从未触及服务器.任何帮助将不胜感激!

I believe that the following call is causing my problems since my call never even touches the server when I make a request. Any help would be greatly appreciated!

呼叫:

NSDictionary *response = [[NetworkManager sharedManager] loginWithName:name password:pwd];

方法:

- (NSDictionary *)loginWithName:(NSString *)name password:(NSString *)pwd
{
    NSURL *url = [NSURL URLWithString:@"http://www.test.com/keys"];
    NSArray *values = [NSArray arrayWithObjects:@"iphone", @"iphone@test.com", name, pwd, nil];
    NSArray *keys = [NSArray arrayWithObjects:@"name", @"email", @"username", @"password", nil];
    NSDictionary *response = [self startNetworkPOSTRequestWithUrl:url 
                                                       postValues:values 
                                                          forKeys:keys];
    return response;
}

堆栈跟踪:

 Thread: Unknown Name (Crashed)
    0     libobjc.A.dylib                     0x37b9ef7e objc_msgSend + 21
    1     Test                          0x000dcda5 _mh_execute_header + 126373
    2     Test                          0x000dc4b9 _mh_execute_header + 124089
    3     Test                          0x000cd801 _mh_execute_header + 63489
    4     Test                          0x000ce39d _mh_execute_header + 66461
    5     Test                          0x000cf561 _mh_execute_header + 71009
    6     Test                          0x000d3e3d _mh_execute_header + 89661
    7     UIKit                               0x3334ccbd -[UITextField keyboardInput:shouldInsertText:isMarkedText:] + 148
    8     UIKit                               0x3334cc1f -[UIFieldEditor keyboardInput:shouldInsertText:isMarkedText:] + 94
    9     UIKit                               0x3334cbb9 -[UIKeyboardImpl callShouldInsertText:] + 108
    10   UIKit                               0x3334bb5b -[UIKeyboardImpl addInputString:fromVariantKey:] + 114
    11   UIKit                               0x3334bae1 -[UIKeyboardImpl handleStringInput:fromVariantKey:] + 164
    12   UIKit                               0x3334a775 -[UIKeyboardImpl handleKeyEvent:] + 1320
    13   UIKit                               0x334e48a3 -[UIKeyboardLayoutStar sendStringAction:forKey:isPopupVariant:] + 486
    14   UIKit                               0x33348dcd -[UIKeyboardLayoutStar touchUp:] + 3196
    15   UIKit                               0x333480fd -[UIKeyboardLayout touchesEnded:withEvent:] + 380
    16   UIKit                               0x3324b92b -[UIWindow _sendTouchesForEvent:] + 318
    17   UIKit                               0x3324b319 -[UIWindow sendEvent:] + 380
    18   UIKit                               0x33231695 -[UIApplication sendEvent:] + 356
    19   UIKit                               0x33230f3b _UIApplicationHandleEvent + 5826
    20   GraphicsServices                    0x373f022b PurpleEventCallback + 882
    21   CoreFoundation                      0x357d1523 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 38
    22   CoreFoundation                      0x357d14c5 __CFRunLoopDoSource1 + 140
    23   CoreFoundation                      0x357d0313 __CFRunLoopRun + 1370
    24   CoreFoundation                      0x357534a5 CFRunLoopRunSpecific + 300
    25   CoreFoundation                      0x3575336d CFRunLoopRunInMode + 104
    26   GraphicsServices                    0x373ef439 GSEventRunModal + 136
    27   UIKit                               0x3325fcd5 UIApplicationMain + 1080
    28   Test                          0x000bfc1b _mh_execute_header + 7195

startNetworkPOSTRequestWithUrl 方法的内容:

Contents of the startNetworkPOSTRequestWithUrl method:

- (NSDictionary *)startNetworkPOSTRequestWithUrl:(NSURL *)url
                                      postValues:(NSArray *)values
                                         forKeys:(NSArray *)keys
{
    NSLog(@"saved user info: %@", values);
    __unsafe_unretained __block ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
    __block NSDictionary *response;
    int num = [values count];
    __block BOOL success = YES;

    for (int i = 0; i < num; i++)
    {
        [request setPostValue:[values objectAtIndex:i] forKey:[keys objectAtIndex:i]];
    }

    [request setDelegate:self];
    [request setUseCookiePersistence:NO];
    [request setCompletionBlock:^{
        NSString *responseString = [request responseString];
        response = [responseString JSONValue];
    }];
    [request setFailedBlock:^{
        NSError *error = [request error];
        NSLog(@"
Error: %@", error.localizedDescription);
        NSString *responseString = [request responseString];
        NSLog(@"
Error Response: %@", responseString);
        NSLog(@"
url: %@",url);
        success = NO;
    }];
    [request startSynchronous];

    if (success == NO)
    {
        return nil;
    }

    if (![(NSString *)[response valueForKey:@"status"] isEqualToString:@"success"])
    {
        NSLog(@"response: %@",response);
        return nil;
    }

    return (NSDictionary *)[response valueForKey:@"response"];
}

推荐答案

我发现了另一个奇怪的解决方法来解决我的一些问题:

I found another odd workaround that's solving some of my problems:

目标>下构建设置 >Apple LLVM 编译器 4.0 - 代码生成 >优化级别 我将 Ad Hoc Optimization 更改为 None - 远离默认的 Fastest, Smallest [-Os],这样我就可以创建一个有效的 ipa.

Under Target > Build Settings > Apple LLVM compiler 4.0 - Code Generation > Optimization Level I changed Ad Hoc Optimization to None - away from the default Fastest, Smallest [-Os] and this allows me to create a working ipa.

虽然这确实提供了一种解决方法,但考虑到我不进行优化可能会导致其他后果,它并不理想.

While this does provide a workaround it's less than ideal considering there may be other consequences of me doing no optimization.

但我确实认为这暗示我的一些潜在问题与记忆有关 - 任何人都可以对此提供任何见解吗?

But I do think this hints that some of my underlying problems are memory related - can anyone provide any insights into this?

这篇关于在设备上调试时 Ad Hoc iPhone SIGSEGV 崩溃模拟器工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:在设备上调试时 Ad Hoc iPhone SIGSEGV 崩溃模拟器工作

基础教程推荐