【问题标题】:Ios 5 crashes during [[NSRunLoop currentRunLoop] runModeIos 5 在 [[NSRunLoop currentRunLoop] runMode 期间崩溃
【发布时间】:2012-12-11 09:51:17
【问题描述】:

问题发生在

while (!self.complete && [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]])
{

}

应用程序因信号而崩溃

-[__NSCFString bytes]: unrecognized selector sent to instance 0x8577710

【问题讨论】:

    标签: iphone objective-c xcode ios5


    【解决方案1】:

    您将-bytes 消息发送到NSString 的一个实例。您可能打算将其发送到NSData 的实例。由于您没有展示那部分代码,因此很难说您会采取什么措施来修复它。

    【讨论】:

    • NSURL *dst = [NSURL URLWithString:[self.url stringByAppendingString:self.operation]]; [r setURL:dst]; [r setValue:dst.host forHTTPHeaderField:@"Host"]; [r setHTTPBody:self.request]; [r setValue:[NSString stringWithFormat:@"%d", len] forHTTPHeaderField:@"Content-Length"]; [[NSNotificationCenter defaultCenter] postNotificationName:kRequestFactoryRequestStarted object:nil]; self.connection = [[NSURLConnection alloc] initWithRequest:r delegate:self];
    • 这个问题只出现在IOS 5
    • 由于崩溃发生在等待期间,它更有可能出现在您的委托方法中而不是初始化中。您可以编辑您的问题以在那里显示委托方法吗?这比将它们放在评论中更容易阅读。
    • 我的委托方法不应该被调用
    • 在这种情况下,将NSLog 消息放在每个委托方法的开头和结尾是没有害处的,只是为了跟踪它们何时不被调用。
    猜你喜欢
    • 2012-01-17
    • 2011-12-25
    • 2016-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-09
    • 2012-02-05
    • 2012-08-08
    相关资源
    最近更新 更多