IOS error in CFStringGetLength in CoreFoundation

I get crashing, which seems to me to be an error in how Apple handles the goToDefaultLocation MKMapView message. This message, in turn, calls [ALCityManager localeWithCode:] , which calls [NSLocale componentsFromLocaleIdentifier:] , which calls CFLocaleCreateComponentsFromLocaleIdentifier , which calls CFStringGetLength , and fails.

Can someone help point me in the direction of fixing the error if this is my code that causes this, or by helping me find a workaround if it is actually an error in the Apple 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
+6
source share
2 answers

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

I think it's Apple Bug, iOS4.3 has other ugly regressions regarding MapKit. (e.g. early MKReverseGeocoder release ...)

  • An easy workaround would be to override -[MKMapView goToDefaultLocation] , but with the risk of rejecting Apple because it is a private API ... (Rejected for circumventing the error ... I know ... People are average)

  • Another solution would be to analyze (reverse ...) CFLocaleCreateComponentsFromLocaleIdentifier and componentsFromLocaleIdentifier: and [ALCityManager localeWithCode:] to understand how it might crash when called with locale nil and possibly programmatically fix the locale of the application, since it looks like an error that occurs when determining the locale user from the device settings (or, even worse, from the city / geolocation) ... or at least the WARN user that his language settings can cause problems ... What I just I can not (/ I want) to do without being able to play lime this error.

+2
source

Well, your exception code is EXC_BAD_ACCESS . This is usually a memory management error (i.e., some code tried to access an object that has already been released / released).

It is possible, but very unlikely, that this is a bug in the Apple / framework code. Most likely, somewhere in your code you either re-release something, or attach it to an instance of an object with automatic release, or otherwise gain access to the one that should not be accessed.

Given that the accident occurred in MapKit, I would recommend looking at your map code for possible sources of this failure. Note that MapKit may be a bit conditional; I have seen crashes in cases such as trying to access the current location of the LocationManager when the user has location services disabled. I expect such a case to fail (for example, returning the nil location), but not the application crashing.

+1
source

Source: https://habr.com/ru/post/885774/


All Articles