119

I cant seem to refresh my provisioning profiles in Xcode without crashes. Every time I press the refresh button in organizer it crashes and I retrieve this line from the error log:

UNCAUGHT EXCEPTION (NSInvalidArgumentException): *** setObjectForKey: object cannot be nil (key: teamId)

So I checked my teamId but dont find anything unusual. Anybody have any ideas what causing my problem? This uses to work for me every time I refreshed my profiles. Even did that this morning for like 10 times.

EDIT:

Heres the crash report if needed:

Process:         Xcode [1136]
Path:            /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier:      com.apple.dt.Xcode
Version:         4.6.1 (2067)
Build Info:      IDEApplication-2067000000000000~2
App Item ID:     497799835
App External ID: 14581035
Code Type:       X86-64 (Native)
Parent Process:  launchd [272]
User ID:         501

Date/Time:       2013-03-15 15:21:43.906 +0100
OS Version:      Mac OS X 10.8.3 (12D78)
Report Version:  10

Interval Since Last Report:          14773 sec
Crashes Since Last Report:           9
Per-App Interval Since Last Report:  14523 sec
Per-App Crashes Since Last Report:   7
Anonymous UUID:                      E5C08B95-3313-ABC3-6BB7-F22E76735A98

Crashed Thread:  2  Dispatch queue: NSManagedObjectContext Queue

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information:
ProductBuildVersion: 4H512
UNCAUGHT EXCEPTION (NSInvalidArgumentException): *** setObjectForKey: object cannot be nil (key: teamId)
UserInfo: (null)
Hints: None
Backtrace:
  0  0x00007fff92639aee __exceptionPreprocess (in CoreFoundation)
  1  0x00007fff98d703f0 objc_exception_throw (in libobjc.A.dylib)
  2  0x00007fff926c85b7 -[__NSDictionaryM setObject:forKey:] (in CoreFoundation)
  3  0x0000000107d42d88 +[DTDKTeamBasedService _createRequestDictionaryForTeam:andPlatform:] (in DTDeviceKit)
  4  0x0000000107d45315 +[DTDKDownloadProvisioningProfileService serviceForTeam:andPlatform:andProfileID:withError:] (in DTDeviceKit)
  5  0x0000000107d6e1c0 +[DTDKDownloadProvisioningProfileService serviceForProvisioningProfileRecord:withError:] (in DTDeviceKit)
  6  0x0000000107d73728 __72+[DTDKPortalDatabase _refreshFromProvisioningProfileListServices:error:]_block_invoke (in DTDeviceKit)
  7  0x00007fff9429d4dc developerSubmittedBlockToNSManagedObjectContextPerform (in CoreData)
  8  0x00007fff9429d40a -[NSManagedObjectContext performBlockAndWait:] (in CoreData)
  9  0x0000000107d73246 +[DTDKPortalDatabase _refreshFromProvisioningProfileListServices:error:] (in DTDeviceKit)
 10  0x0000000107d75816 __56+[DTDKPortalDatabase refresh:parentWindow:withCallback:]_block_invoke_5 (in DTDeviceKit)
 11  0x00007fff942cd7cf developerSubmittedBlockToNSManagedObjectContextPerform_privateasync (in CoreData)
 12  0x00007fff90dd20b6 _dispatch_client_callout (in libdispatch.dylib)
 13  0x00007fff90dd347f _dispatch_queue_drain (in libdispatch.dylib)
 14  0x00007fff90dd32f1 _dispatch_queue_invoke (in libdispatch.dylib)
 15  0x00007fff90dd31c3 _dispatch_worker_thread2 (in libdispatch.dylib)
 16  0x00007fff964d4d0b _pthread_wqthread (in libsystem_c.dylib)
 17  0x00007fff964bf1d1 start_wqthread (in libsystem_c.dylib)

objc[1136]: garbage collection is ON
abort() called
.....
[The report itself is very large and contains much more than this]
D_4_ni
  • 901
  • 6
  • 18
Mark Molina
  • 5,057
  • 8
  • 41
  • 69
  • Maybe try deleting all your existing profiles... You usually get 2 support tickets with your developer account, so you might want to simply ask Apple directly. – mrueg Mar 15 '13 at 15:07
  • 4
    I just started getting this error today as well. – nh32rg Mar 18 '13 at 18:15
  • 11
    I don't see why this question should be closed? It's related to programming and software development, as xcode is a tool to write software. – Dallas Clark Mar 18 '13 at 20:31
  • Might this be a new issue with Apple? I'm getting the same thing. – Jenn Mar 18 '13 at 20:43
  • 5
    You can get around the problem by manually downloading your certificates and provisioning profiles from developer.apple.com – Dallas Clark Mar 18 '13 at 21:21
  • Jep that worked for me too but I yet have to find a working fix for the crashes. Reported the bug yesterday btw – Mark Molina Mar 19 '13 at 09:29
  • 2
    same to me. I v did some change add/remove certificate and keys. after that i m having this problem. in the morning xcode 4.6.1 is updated. – karim Mar 19 '13 at 22:28
  • I was able to get around this my reverting back to Xcode 4.5.2. I refresh the portal info in Xcode 4.5.2, then switch back to 4.6.1 for development. – Daniel Mar 20 '13 at 05:19
  • Is it possible to reopen this question so people can post their answers? – Mark Molina Mar 20 '13 at 15:26
  • How did you revert back to 4.5.2? I'd like to do the same. – pwightman Mar 21 '13 at 01:45
  • 1
    This question is about programming .... grrr... I need the answer. – Artilheiro Mar 21 '13 at 07:59
  • I have the same problem after renewing developer account. It's a mess. It only works if I manually download certs and profiles. – Borut Tomazin Mar 21 '13 at 08:22
  • I'm getting it now... just started happening in the last few days... – rcw3 Mar 21 '13 at 14:34
  • I'm also getting this crash at the moment. I don't use the feature often though, so I can't say if this is a recent problem or not. – Mike Weller Mar 21 '13 at 15:37
  • ah the vote passed and answers can be posted again! – Mark Molina Mar 21 '13 at 16:09
  • Anyone have an answer? – Richard Grossman Mar 21 '13 at 19:48
  • This only started happening to me after upgrading to Xcode 4.6.1. The answer above fixed this for me. Removing the 4.6.1.db file. – Michael Wood Mar 22 '13 at 21:20
  • This is happening again. The crash i'm getting says UNCAUGHT EXCEPTION (NSInvalidArgumentException): -[NSURLCredentialStorage _reestablishInternalCFCachedURLResponse:]: unrecognized selector sent to instance 0x4008d27c0 – Tony Jun 25 '13 at 23:25

4 Answers4

179

Remove this file:

~/Library/Developer/Xcode/connect1.apple.com 4.6.1.db

before running Xcode 4.6.1.

Ron
  • 3,055
  • 1
  • 20
  • 21
Godfrey Chung
  • 1,791
  • 2
  • 10
  • 2
  • 1
    perfect, there were two files i removed "connect1.apple.com 4.6.1.db" was updated the same morning the problem started. – Jim True Mar 22 '13 at 14:36
  • 7
    Here's Apple's official workaround: https://devforums.apple.com/message/796388#796388 – Bobjt Mar 25 '13 at 22:57
  • (Re)moving only the one file didn't work for me, so I also (re)moved `iOS Device Logs*` `connect*` and `DerivedData` - and it works again. – schmunk Mar 28 '13 at 11:52
  • woohoo!! smiles again, thank you! This solves the Team "Unknown" also. – Alex Nolasco Mar 31 '13 at 03:48
62

Here is apple's official workaround:

Run this command in terminal:

mkdir ~/Library/Developer/Xcode/OldPortalDBs; mv ~/Library/Developer/Xcode/connect1.apple.com* ~/Library/Developer/Xcode/OldPortalDBs

Worked like a charm for me.

Mark Molina
  • 5,057
  • 8
  • 41
  • 69
  • Even after doing that I have been experiencing that the problem reoccurs after some days. For that I made an command alias. If you want it too, just add this `alias uncrashxcode='mkdir ~/Library/Developer/Xcode/OldPortalDBs 2>/dev/null; mv ~/Library/Developer/Xcode/connect1.apple.com* ~/Library/Developer/Xcode/OldPortalDBs 2>/dev/null'` to any of your `~/.profile` or `~/.bashrc` files. – Ricardo Sanchez-Saez Apr 10 '13 at 13:02
  • Thank you so much! Looking at Apple's official workaround (which moves the files starting with 'connect1.apple.com' to another folder), I found it easier to trash any file starting with 'connect1.apple.com'. In this way, too, you can put them back if it doesn't work. But it worked like a charm for me. :) – Timo May 02 '13 at 11:14
2

Someone had this problem at NSCoder Night this week. Cleared by removing:

~/Library/Caches/com.apple.dt.Xcode.

sqlite3 ~/Library/Caches/com.apple.dt.Xcode/PortalData/connect1.apple.com

Shows that file to be an SQLite database, with references to certificates, teams, and profiles. I suspect (but haven't tried) that removing the PortalData folder would be sufficient to clear the error.

Irfan
  • 4,301
  • 6
  • 29
  • 46
Hal Mueller
  • 7,019
  • 2
  • 24
  • 42
1

Removing this file worked for me.

~/Library/Developer/Xcode/connect1.apple.com 4.6.1.db

Thanks!

Irfan
  • 4,301
  • 6
  • 29
  • 46