Xcode 'Organization Identifier'

When you create a NEW Xcode project you are presented with a screen to fill in basic project information. One is Organization Identifier, which is filled in with the value from the last project you created.

Where is that stored? I need to be able to read that value, and use it when creating an external file

If it is within your application, [[NSBundle mainBundle] bundleIdentifier].

No, that is NOT what I am looking for…
I need to read the ORG ID (not bundle id), and I need the one that Xcode would assign to a new app, not the one assigned to the app being executed.

Somewhere in the system that value is stored.
If I were to give you an app, and you ran it, I want it to display the Org ID, that is on YOUR computer, not the one that is on mine.

maybe an xcode setting that it retains from run to run ?
not sure where it stores its per user data

that is exactly what I think it is… the question is either where is it? or is there an API call to get it.

I have an app the is building a ‘project.pbxproj’ file and this is one of the key elements that needs to be in that file

possibly ~/Library/Preferences/com.apple.dt.Xcode.plist ?



and there is ~/Library/Preferences/com.apple.Xcode.plist

could be something in either one


Right plist, wrong entry, but it gave me a place to look :slight_smile:


Ah that key makes WAY more sense too !

And so now you know the plist & key you can grab it with the user defaults API’s :+1:

1 Like

kicked in the teeth again by lack of proper docs.
I found this that I thought could be altered…

public var acceptedXcodeVersion: String {
	var acceptedXcodeVersion = ""
	let licensePlistPath = "/Library/Preferences/com.apple.dt.Xcode.plist"
	if FileManager.default.fileExists(atPath: licensePlistPath) {
		if let licenseInfo = NSDictionary(contentsOfFile: licensePlistPath) {
			print(licenseInfo) // I expected the ENTIRE Plist here?
			if let version = licenseInfo["IDEXcodeVersionForAgreedToGMLicense"] as? String {
				acceptedXcodeVersion = version

	return acceptedXcodeVersion

but for some reason it only read a tiny tiny part of the whole Plist file

but as a plist dict wouldnt it be a dict that contains arrays & other dicts as well as simple key value pairs etc ?

maybe Apple Developer Documentation and the domain is “com.apple.dt.Xcode.plist” ?

sigh… no idea…

such helpful Apple documentation :slight_smile:

Follow Norman’s advice, as his is the recommend method since macOS 10.7.

LOL… and exactly what “advice” was that?

Use the user defaults classes for the domain “com.apple.dt.Xcode.plist”

1 Like

Hello folks newbie here.

Found the site when google searching for “getting line numbers from an NSTextView”.
And found a posting here by DaveS, so returning the favour for that code Dave.

As has been pointed out by others, “UserDefaults” is best for writing and reading preferences for your own app’s.
But I tend to use the “PropertyListSerialization” swift class for reading and writing plist files of others, and non preference xml type storage solutions.
Something like this.

    public var xcodeAcceptedVersion: String {
        var xcodeAcceptedVersion = String()
        let xcodePlistFileURL = URL(fileURLWithPath: "/Library/Preferences/com.apple.dt.Xcode.plist")
        do {
            let xcodePlistFileData = try Data(contentsOf: xcodePlistFileURL, options: .mappedIfSafe)
            let xcodePlistDictionary = try PropertyListSerialization.propertyList(from: xcodePlistFileData,
                                                                                  options: .mutableContainersAndLeaves,
                                                                                  format: nil) as! [String: Any]
            if let plistXcodeVersion = xcodePlistDictionary["IDEXcodeVersionForAgreedToGMLicense"] as? String {
                xcodeAcceptedVersion = plistXcodeVersion
        } catch {
            // Error reading file URL Data or creating property list Dictionary
            xcodeAcceptedVersion = ""
        return xcodeAcceptedVersion

Hope that helps.

Regards Mark

Here is a much shorter method… Thanks to guideance from Norman :slight_smile:

let xcodePlist = UserDefaults(suiteName: "com.apple.dt.Xcode.plist")
if let retValue:AnyObject = xcodePlist!.object(forKey: "IDETemplateOptions")  as AnyObject?  {
   //	print("Value : \(retValue)") // if you want to see other "keys"
   let bundleIDPrefix : String = retValue["bundleIdentifierPrefix"] as! String
} else {

welcome to our little world :stuck_out_tongue:

Thanks Norman.

I haven’t used RS / Xojo for over a decade, so I can’t contribute much on that front.
But I see some other fellow Swift coders here, who I guess I can swap ideas with.

We have all kinds here
and I’m sure there are others

INN, while largely populated by a lot of Xojo users, is more about x-platform than just a single tool set