iOS 在 CoreFoundation 中的 CFStringGetLength 中崩溃

发布于 2024-10-31 18:27:00 字数 2411 浏览 4 评论 0原文

我遇到了崩溃,对我来说,这似乎是 Apple 处理 MKMapView 的 goToDefaultLocation 消息的方式中的错误。该消息依次调用 [ALCityManager localeWithCode:],后者又调用 [NSLocale ComponentsFromLocaleIdentifier:],后者又调用 CFLocaleCreateComponentsFromLocaleIdentifier,后者又调用 CFStringGetLength code> 并发生崩溃。

有人可以帮助我指出修复错误的方向吗(如果是我的代码导致了这个问题),或者帮助我找到解决方法,如果事实上这是苹果代码中的错误(不太可能?)。

崩溃日志如下:

Incident Identifier: 84198BB6-45BD-493B-955F-75CCB5246DDD
CrashReporter Key:   7dbf53bf1f1a3635d7c3c49e726dedc609ed9f3a
Hardware Model:      iPhone3,1
Process:         MyApp [340]
Path:            /var/mobile/Applications/DCE9A5A1-8E24-4D4F-A1ED-9855C6CA1742/MyApp.app/MyApp
Identifier:      MyApp
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2011-03-25 10:36:06.382 -0700
OS Version:      iPhone OS 4.3 (8F190)
Report Version:  104

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   CoreFoundation                  0x00009a66 CFStringGetLength + 6
1   CoreFoundation                  0x0002f994 CFLocaleCreateComponentsFromLocaleIdentifier + 60
2   CoreFoundation                  0x000483b8 +[NSLocale componentsFromLocaleIdentifier:] + 12
3   AppSupport                      0x00016eee -[ALCityManager localeWithCode:] + 130
4   MapKit                          0x00038488 -[MKMapView goToDefaultLocation] + 80
5   Foundation                      0x000907c6 __NSFireTimer + 130
6   CoreFoundation                  0x00075a40 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
7   CoreFoundation                  0x00077ec4 __CFRunLoopDoTimer + 844
8   CoreFoundation                  0x0007883e __CFRunLoopRun + 1082
9   CoreFoundation                  0x00008ebc CFRunLoopRunSpecific + 224
10  CoreFoundation                  0x00008dc4 CFRunLoopRunInMode + 52
11  GraphicsServices                0x00004418 GSEventRunModal + 108
12  GraphicsServices                0x000044c4 GSEventRun + 56
13  UIKit                           0x0002ed62 -[UIApplication _run] + 398
14  UIKit                           0x0002c800 UIApplicationMain + 664
15  MyApp                               0x000023f0 main (main.m:34)
16  MyApp                               0x00002370 start + 44

I'm getting a crash that, to me, seems as though it is a bug in the way that Apple is handling the goToDefaultLocation message of MKMapView. That message in turn calls [ALCityManager localeWithCode:], which calls [NSLocale componentsFromLocaleIdentifier:] which calls CFLocaleCreateComponentsFromLocaleIdentifier which calls CFStringGetLength and the crash occurs.

Can someone help to point me in the direction of either fixing the bug, if it is my code that is causing this, or, helping me find a workaround if, in fact, this is a bug in Apple's code (unlikely??).

Crash log below:


Incident Identifier: 84198BB6-45BD-493B-955F-75CCB5246DDD
CrashReporter Key:   7dbf53bf1f1a3635d7c3c49e726dedc609ed9f3a
Hardware Model:      iPhone3,1
Process:         MyApp [340]
Path:            /var/mobile/Applications/DCE9A5A1-8E24-4D4F-A1ED-9855C6CA1742/MyApp.app/MyApp
Identifier:      MyApp
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2011-03-25 10:36:06.382 -0700
OS Version:      iPhone OS 4.3 (8F190)
Report Version:  104

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   CoreFoundation                  0x00009a66 CFStringGetLength + 6
1   CoreFoundation                  0x0002f994 CFLocaleCreateComponentsFromLocaleIdentifier + 60
2   CoreFoundation                  0x000483b8 +[NSLocale componentsFromLocaleIdentifier:] + 12
3   AppSupport                      0x00016eee -[ALCityManager localeWithCode:] + 130
4   MapKit                          0x00038488 -[MKMapView goToDefaultLocation] + 80
5   Foundation                      0x000907c6 __NSFireTimer + 130
6   CoreFoundation                  0x00075a40 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
7   CoreFoundation                  0x00077ec4 __CFRunLoopDoTimer + 844
8   CoreFoundation                  0x0007883e __CFRunLoopRun + 1082
9   CoreFoundation                  0x00008ebc CFRunLoopRunSpecific + 224
10  CoreFoundation                  0x00008dc4 CFRunLoopRunInMode + 52
11  GraphicsServices                0x00004418 GSEventRunModal + 108
12  GraphicsServices                0x000044c4 GSEventRun + 56
13  UIKit                           0x0002ed62 -[UIApplication _run] + 398
14  UIKit                           0x0002c800 UIApplicationMain + 664
15  MyApp                               0x000023f0 main (main.m:34)
16  MyApp                               0x00002370 start + 44

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

上课铃就是安魂曲 2024-11-07 18:27:00

我得到了完全相同的崩溃报告,仅适用于 iOS 4.3 / 4.3.1 和 iPhone 3GS/4 (armv7),

我认为这是一个 Apple Bug,iOS4.3 还有其他关于 MapKit 的丑陋回归。 (如 MKReverseGeocoder 早期发布崩溃...)

  1. 一个简单的解决方法是覆盖 -[MKMapView goToDefaultLocation] 但在由于它是私有 API,因此存在被 Apple 拒绝的风险...(因错误解决方法而被拒绝...我知道...人们都很刻薄)

  2. 另一种解决方案是分析(反向...) CFLocaleCreateComponentsFromLocaleIdentifiercomponentsFromLocaleIdentifier:[ALCityManager localeWithCode:] 了解它如何崩溃,如何使用 nil 区域设置标识符调用,并可能以编程方式修复应用程序区域设置,因为它看起来像是来自从设备设置(或更糟糕的是,从城市/地理位置)确定用户的区域设置的错误...或者至少警告用户其区域设置可能会引起麻烦...
    我只是不能(/想要)做一些事情,无法重现该错误。

I got exactly the same crash reports, ONLY with iOS 4.3 / 4.3.1 AND iPhone 3GS/4 (armv7)

I think it is an Apple Bug, iOS4.3 has others ugly regressions concerning MapKit. (like the MKReverseGeocoder early releasing crash...)

  1. An easy workaround would be to override -[MKMapView goToDefaultLocation] but at the risk of an Apple rejection since it is a private API... (Rejected for a bug workaround... I know... People are mean)

  2. Another solution would be to analyze (reverse...) CFLocaleCreateComponentsFromLocaleIdentifier and componentsFromLocaleIdentifier: and [ALCityManager localeWithCode:] to understand how it can crash, being called with a nil locale identifier and maybe fix application locale programmatically, since it looks like the error coming from determining user's locale from device settings (or worse, from city/geolocation)... or at least WARN user that its locale settings might cause troubles...
    Something I just can not(/want to) do, not being able to reproduce that bug.

空名 2024-11-07 18:27:00

那么您的异常代码是EXC_BAD_ACCESS。这通常是一个内存管理错误(即某些代码试图访问已经被释放/释放的对象)。

这有可能但不太可能是 Apple/框架代码中的错误。更有可能的是,在代码中的某个地方,您要么过度释放某些内容,要么挂在自动释放的对象实例上,或者以其他方式访问不应访问的内容。

鉴于崩溃发生在 MapKit 中,我建议您查看与地图相关的代码以了解此崩溃的可能来源。请注意,MapKit 可能有点不稳定;我见过在用户关闭位置服务时尝试访问 LocationManager 的当前位置等情况下发生的崩溃。我希望这种情况会失败(例如,返回一个 nil 位置),但不会使应用程序崩溃。

Well your exception code is EXC_BAD_ACCESS. This is generally a memory-management error (i.e. some bit of code tried to access an object that had already been released/dealloc'ed).

It is possible but very unlikely that this is a bug in Apple/framework code. It's more likely that somewhere in your code you are either over-releasing something or hanging on to an auto-released object instance or otherwise accessing something that shouldn't be accessed.

Given that the crash happened in MapKit, I'd recommend looking at your map-related code for possible sources of this crash. Note that MapKit can be a bit tempermental; I've seen crashes in cases such as attempting to access the LocationManager's current-location when the user has location-services turned off. I'd expect such a case to fail (for instance, by returning a nil location), but not to crash the app.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文