Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4.2: Error 0xC002 when trying to use a jailbroken iPhone 3G for development

I have this jailbroken iPhone 3G with iOS version 4.2.1 (the latest supported version). When I connect it to Xcode 4.2, Xcode starts copying the debug symbols. It stops copying towards the end of the process, and shows the following error:

Xcode has encountered an unexpected error (0xC002)
No such file or directory, at ‘/SourceCache/DTDeviceKit/DTDeviceKit-867/DTDeviceKit/DTDeviceKit_Utilities.m:864’

Anybody experiencing anything similar?

I know I should try and restore the phone, but I'm asking just in case anybody can come up with a solution that doesn't involve restoring it.

In this post on mactechnews.de, one guy reports the same problem -- with no solution, so far.

like image 900
Ricardo Sanchez-Saez Avatar asked Oct 27 '11 20:10

Ricardo Sanchez-Saez


1 Answers

Alright, after a lot of testing and digging up the filesystem... I solved it. It turns out that there are just a few files that are not downloaded from the device (for reasons still unknown). They are related to the dyld cache (don't really know what this is and what it's for). Here are the steps to make your 4.2.1 device debuggable in XCode 4.2 and 4.3.x:

  1. Close Xcode
  2. Go to: ~/Library/Developer/Xcode/iOS DeviceSupport/4.2.1 (8C148)/Symbols/System/Library/Caches/com.apple.dyld/
    Note: if you don't have this folder, run Xcode, connect your device, and wait until the error 0xC002 appears in Organizer - the folder should be created by that time.
  3. Create 3 empty files there called:
    • .copied_dyld_shared_cache_armv6
    • .processed_dyld_shared_cache_armv6
    • dyld_shared_cache_armv6
  4. Run Xcode and enjoy the light next to your device eventually go green:)

Or, for the terminal lovers:

cd ~/Library/Developer/Xcode/iOS\ DeviceSupport/4.2.1\ \(8C148\)/Symbols/System/Library/Caches/com.apple.dyld/
touch .copied_dyld_shared_cache_armv6
touch .processed_dyld_shared_cache_armv6
touch dyld_shared_cache_armv6


This is obviously a hack but it works perfectly for debugging and I haven't noticed any side-effects so far.
Enjoy!

Small update:
I tested it on my snow leopard hackintosh, with the Xcode 4.2 (most recent to date) and although the device is active in the organizer and it is possible to run the app on the device, i get black screen on launch. It gets installed but apparently debugger cannot get attached. I had the same problem with 4.0.2, when the 0xC002 problem didn't yet occur so I think it's unrelated and might even not happen to others. Nevertheless, 0xC002 is still solved.
On my main development machine with Lion and Xcode 4.3.2, device is perfectly debuggable.

like image 75
Bartek Eborn Avatar answered Nov 21 '22 13:11

Bartek Eborn