iPhone 在特定设备上崩溃
我的应用程序包括滚动视图/页面控制,并从网络获取图像并显示在滚动视图上。它在 ipod 2nd Gen 和模拟器上运行良好,但在 Iphone 3GS 上有些崩溃。显然它在
NSData *htmlData = [[NSString stringWithContentsOfURL:[NSURL URLWithString:url]
encoding:NSASCIIStringEncoding error:&error]
dataUsingEncoding:NSUTF8StringEncoding];
这条线上崩溃了。我不知道什么会导致它崩溃,因为它在其他设备和模拟器上运行顺利。任何帮助将不胜感激。
My app includes scrollview/pagecontrol and get image from web and display on scrollview. It works fine on ipod 2nd Gen and Simulator but somewhat it crashes on Iphone 3GS. Apparently it crashes on
NSData *htmlData = [[NSString stringWithContentsOfURL:[NSURL URLWithString:url]
encoding:NSASCIIStringEncoding error:&error]
dataUsingEncoding:NSUTF8StringEncoding];
this line. I have no idea what would cause to crash on it since it works smoothly on other device and simulator. Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来您将
NSString
的编码指定为NSASCIIStringEncoding
,但数据为NSUTF8StringEncoding
- 尝试使这两者相同,并查看错误是否仍然出现。It seems that you specify the encoding of the
NSString
to beNSASCIIStringEncoding
, but the data to beNSUTF8StringEncoding
- try making both of these the same, and see if the error still occurs.您能向我们展示您的回溯吗?
我猜问题不在于 2G 和 3G。
您的编码问题使用其他编码格式,例如: NSASCIIStringEncoding
Can you show us your traceback
I guess issue is not with the 2G and 3G.
the problem with your encoding use other encoding format for ex: NSASCIIStringEncoding