Mac Sandbox and XCode 3.x - xcode

Is there a way to be Sandbox-compliant compiling apps with XCode 3.x?
Are there any articles or tutorials out there on how to do this?
I'm the developer of a Mac application and I'm stuck with XCode 3 because
the app uses two IBPlugins which (as far as I know) are not supported in
XCode 4.x. Sandboxing apps will be mandatory to publish them on the Mac
AppStore beginning November 2011 (still no updates on this, any news?)

You can create an entitlements property list by hand and sign your application bundle from the command line, as described in the Code Signing And Application Sandboxing Guide. You may need to have a copy of Xcode 4 installed for its version of the codesign utility, however you can have multiple versions installed simultaneously (refer to the xcrun and xcode-select man pages).

Related

How to Build an Application compatible with older MacOS with Xcode?

I just installed the latest version of Xcode (10.1) on MacOS 10.14 (Mojave).
I can build my application and it runs fine on my Mac or similar system.
However, I want to share this application with someone using MacOS 10.11 (El Capitan) and it fails to launch, asking for a minimum requirement of MacOS 10.13 (High Sierra).
My application is only very simple, can't I compile it to be compatible with older MacOS ?
After some research, I did download MacOSX10.11.sdk
(from https://github.com/phracker/MacOSX-SDKs/releases/).
I did decompress it, and drag it into:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
(This folder originally contains only "MacOSX.sdk" and a link pointing to it, named "MacOSX10.14.sdk")
I also noticed the value of the string "MinimumSDKVersion" from the file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist is equal to "10.11", which sounds good in my case.
I read on some forums adding additional SDK versions into Xcode is not supported. And by the way, I cannot see any menu from Xcode to specify my target build (neither in Xcode Preferences, nor in the project settings (see picture below).
Where can I tell Xcode to use, let's say "MacOSX10.11.sdk" over "MacOSX10.14.sdk"?
And, is there a better way?
Or, do I have to install an old version of MacOS on a different partition, with an old version of Xcode (which would be a pain)?
I am not sure if this still works on Mojave, but there is a project called XcodeLegacy which is created specifically with this intention in mind:
https://github.com/devernay/xcodelegacy
Regarding the menu, you can find it at: Xcode -> Select File -> Project/Workspace Setting
Open Workspace Settings
Works on Xcode 13, I'm a bit late to the party but just had the very same question.

Configuring app sandbox in Xcode 4 under Snow Leopard

Is it possible to configure Mac App Store application sandboxing if I'm using Xcode 4 + Snow Leopard? I'm reading the guide by Apple but I don't see anything about entitlements in the summary tab. Does this mean that all MAS developers will need to build their app on Lion?
This is not an authoritative answer but this question leads me to think that XCode 4.2 is required to get these features. My XCode certainly didn't upgrade automatically to 4.2 but the 2nd answer provides a torrent download link for XCode 4.2.
Here is a link to using sandbox in SL.
Security entitlements are passed to the codesign command line tool during the build process. I just tested building a "Developer ID" application on Snow Leopard with sandbox entitlements.
Yeah I also try on snow leopard with xcode 4.2 .It didn't provide any option of entitlements.
But on lion its perfect.And I think there is no alternative other than compiling on it lion OS.
I found that the best way to go was to install Lion and use Xcode 4.3 or up. You will need to look for messages from sandboxd in the Console app to be able to catch sandbox violations and add the appropriate entitlements. AFAIK, this workflow wont work on Snow Leopard as sandboxd is not available.

How do I download and install just the iOS SDK? [duplicate]

Silly question - Is there a way to download the iPhone SDK without Xcode when Apple releases an update?
As far as I understand you cannot download the SDK separately - and even if you could, I wouldn't recommend it. Using the bundled SDK+Xcode release is the best idea in my opinion, as it will be working for you out of the box. I know it's annoying having to download such a large amount of data for an SDK (not all of us have 100mbps pipes to play with!) but for ease of development, it's the way I'd recommend you go.
For those who have installed Xcode but do not have the iOS SDK, here is the way to download it without re-downloading Xcode:
Got to
Xcode > Preferences > Downloads
and select whatever you want to install.
Yes, contrary to what others say this is somewhat possible.
Method One
With this method you can download any iOS or OSX SDK and install it to XCode.
Download the desired SDK, bundled with XCode, from developer.apple.com/downloads
Once the package is done downloading mount the disk image. Right on the XCode application in the image and click on Show Package Contents. Navigate to:
/Contents/Developer/Platforms/
the iOS SDKs are in:
iPhoneOS.platform/Developer/SDKs/
the OSX SDKs are in:
MacOSX.platform/Developer/SDKs/
and the iOS simulator SDKs are in:
iPhoneSimulator.platform/Developer/SDKs/
To install one of the SDKs simply find XCode.app and place the SDK in the appropriate folder of the XCode.app package.
Method Two
With this method you can only dowload iOS simulators and iOS simulator SDKs.
Open XCode and in the menu bar click on XCode > Preferences. In the preferences dialog select the downloads tab and select the simulators you would like to dowload.
Unfortunately, no. Apple only provides the SDK as a bundled package.
They quite often include fixes and updates in the bundled version of xcode. I guess this is a good way for them to "force" people to use the latest point release of xcode.
The answer to the question being asked is, I think, that it is not possible. However, there is a highly related question (with a more interesting answer), how to use different/nonresident iOS SDKs with a particular version of Xcode? This does require downloading some other Xcode (to gain access to some other iOS SDK).
This issue has been a passion of mine for approximately the last 10 years, since I enjoy the stability of (or, at least, predictability of known misbehaviors in) a familiar IDE (i.e. Xcode) version. I last investigated the solution to this issue 3 years ago, and it was slightly more involved than the solution from 5 or so years before that. Here are my notes, from 2017:
SDK
What the development environment treats as the target device, e.g. compilation, IDE behaviors like displaying interface definitions/headers and code completion).
The "Base SDK" (in the "Build Settings" of a target in a project, which is possibly contained by a workspace) setting defaults to "Latest iOS", which resolves to a specific iOS version based on the contents of the Xcode app package directory
<app-package>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
A version of the Xcode application will ship (via Mac App Store or a disk image from developer.apple.com) with only one SDK. The above path will contain a directory named iPhoneOS.sdk and an alias (symbolic link) targeting this directory that is named according to the SDK version (iPhoneOS10.0.sdk -> iPhoneOS.sdk)
No application-provided means (i.e. preference of other UI affordance) for altering this characteristic.
While the plural form of the directory name (SDKs) seems like a vexing/mocking choice, you can modify the contents of this intra-app-package directory to include symbolic links to SDKs contained in other versions of Xcode.
This appears to only work in the forward direction, i.e. using a newer SDK in an older Xcode (e.g. iOS 10 SDK in Xcode 7). This direction has always met my historical needs. Only recently have I attempted to go backwards (make a newer Xcode use an older SDK, e.g. iOS 8.4 SDK in Xcode 7), and I discovered that recent Xcode installs (versions 8.0 and 7.3.1 on a 10.11.6 system) ignore symbolic links to older SDKs (i.e. they do not appear in a target's Base SDK popup menu – screen shot of Xcode 7.3.1 ignoring the iOS 8.4 SDK symlink).
UPDATE (new details): I double-checked my home machine (which I had used for additional multi-SDK experiments) and found that older SDKs do appear in the Base SDK popup. Mysterious! This is a 10.10.5 system, running Xcode 7.2.1 (which ships with iOS 9.2 SDK), editing a different (non-iovation) Xcode project, and the iOS 8.2 SDK (from Xcode 6.2) will display in the popup. Obviously, there are numerous differences between the setup, and I have no idea which variables cause the difference in behavior.
MYSTERY SOLVED: Recent Xcode installs (the aforementioned versions 8.0 and 7.3.1) include a MinimumSDKVersion key in the …/iPhoneOS.platform/Info.plist file. This key appears to be set to the SDK that ships with Xcode (i.e. inside the app package), and, consequently, blocks Xcode from recognizing older SDKs. I was first keyed onto this minimum-version mechanism from the xcodebuild command-line tool, which was printing out, "Skipped SDK <sdk-path>; its version (8.4) is below required minimum (10.0) for the iphoneos platform."
Editing MinimumSDKVersion plist key (e.g. making it 8.0) allows for the display and selection of older SDKs!
The fact that Apple rigidly binds SDK version to Xcode version has always bothered me. Oftentimes, I would prefer to add an SDK to an existing Xcode install, rather than updating the entire Xcode environment simply to gain support for a new version of iOS. Admittedly, bringing everything along in lock-step fashion (app, tools, device and OS support) does seem like it should simplify support issues for Apple, and, perhaps, they believe this conjoined progression also simplifies things for 3rd party devs (no options to fret over, just update the app).

Xcode: must re-download all of Xcode to get iOS SDK? [duplicate]

Silly question - Is there a way to download the iPhone SDK without Xcode when Apple releases an update?
As far as I understand you cannot download the SDK separately - and even if you could, I wouldn't recommend it. Using the bundled SDK+Xcode release is the best idea in my opinion, as it will be working for you out of the box. I know it's annoying having to download such a large amount of data for an SDK (not all of us have 100mbps pipes to play with!) but for ease of development, it's the way I'd recommend you go.
For those who have installed Xcode but do not have the iOS SDK, here is the way to download it without re-downloading Xcode:
Got to
Xcode > Preferences > Downloads
and select whatever you want to install.
Yes, contrary to what others say this is somewhat possible.
Method One
With this method you can download any iOS or OSX SDK and install it to XCode.
Download the desired SDK, bundled with XCode, from developer.apple.com/downloads
Once the package is done downloading mount the disk image. Right on the XCode application in the image and click on Show Package Contents. Navigate to:
/Contents/Developer/Platforms/
the iOS SDKs are in:
iPhoneOS.platform/Developer/SDKs/
the OSX SDKs are in:
MacOSX.platform/Developer/SDKs/
and the iOS simulator SDKs are in:
iPhoneSimulator.platform/Developer/SDKs/
To install one of the SDKs simply find XCode.app and place the SDK in the appropriate folder of the XCode.app package.
Method Two
With this method you can only dowload iOS simulators and iOS simulator SDKs.
Open XCode and in the menu bar click on XCode > Preferences. In the preferences dialog select the downloads tab and select the simulators you would like to dowload.
Unfortunately, no. Apple only provides the SDK as a bundled package.
They quite often include fixes and updates in the bundled version of xcode. I guess this is a good way for them to "force" people to use the latest point release of xcode.
The answer to the question being asked is, I think, that it is not possible. However, there is a highly related question (with a more interesting answer), how to use different/nonresident iOS SDKs with a particular version of Xcode? This does require downloading some other Xcode (to gain access to some other iOS SDK).
This issue has been a passion of mine for approximately the last 10 years, since I enjoy the stability of (or, at least, predictability of known misbehaviors in) a familiar IDE (i.e. Xcode) version. I last investigated the solution to this issue 3 years ago, and it was slightly more involved than the solution from 5 or so years before that. Here are my notes, from 2017:
SDK
What the development environment treats as the target device, e.g. compilation, IDE behaviors like displaying interface definitions/headers and code completion).
The "Base SDK" (in the "Build Settings" of a target in a project, which is possibly contained by a workspace) setting defaults to "Latest iOS", which resolves to a specific iOS version based on the contents of the Xcode app package directory
<app-package>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
A version of the Xcode application will ship (via Mac App Store or a disk image from developer.apple.com) with only one SDK. The above path will contain a directory named iPhoneOS.sdk and an alias (symbolic link) targeting this directory that is named according to the SDK version (iPhoneOS10.0.sdk -> iPhoneOS.sdk)
No application-provided means (i.e. preference of other UI affordance) for altering this characteristic.
While the plural form of the directory name (SDKs) seems like a vexing/mocking choice, you can modify the contents of this intra-app-package directory to include symbolic links to SDKs contained in other versions of Xcode.
This appears to only work in the forward direction, i.e. using a newer SDK in an older Xcode (e.g. iOS 10 SDK in Xcode 7). This direction has always met my historical needs. Only recently have I attempted to go backwards (make a newer Xcode use an older SDK, e.g. iOS 8.4 SDK in Xcode 7), and I discovered that recent Xcode installs (versions 8.0 and 7.3.1 on a 10.11.6 system) ignore symbolic links to older SDKs (i.e. they do not appear in a target's Base SDK popup menu – screen shot of Xcode 7.3.1 ignoring the iOS 8.4 SDK symlink).
UPDATE (new details): I double-checked my home machine (which I had used for additional multi-SDK experiments) and found that older SDKs do appear in the Base SDK popup. Mysterious! This is a 10.10.5 system, running Xcode 7.2.1 (which ships with iOS 9.2 SDK), editing a different (non-iovation) Xcode project, and the iOS 8.2 SDK (from Xcode 6.2) will display in the popup. Obviously, there are numerous differences between the setup, and I have no idea which variables cause the difference in behavior.
MYSTERY SOLVED: Recent Xcode installs (the aforementioned versions 8.0 and 7.3.1) include a MinimumSDKVersion key in the …/iPhoneOS.platform/Info.plist file. This key appears to be set to the SDK that ships with Xcode (i.e. inside the app package), and, consequently, blocks Xcode from recognizing older SDKs. I was first keyed onto this minimum-version mechanism from the xcodebuild command-line tool, which was printing out, "Skipped SDK <sdk-path>; its version (8.4) is below required minimum (10.0) for the iphoneos platform."
Editing MinimumSDKVersion plist key (e.g. making it 8.0) allows for the display and selection of older SDKs!
The fact that Apple rigidly binds SDK version to Xcode version has always bothered me. Oftentimes, I would prefer to add an SDK to an existing Xcode install, rather than updating the entire Xcode environment simply to gain support for a new version of iOS. Admittedly, bringing everything along in lock-step fashion (app, tools, device and OS support) does seem like it should simplify support issues for Apple, and, perhaps, they believe this conjoined progression also simplifies things for 3rd party devs (no options to fret over, just update the app).

How to update iPhone SDK without having to re-download Xcode?

Silly question - Is there a way to download the iPhone SDK without Xcode when Apple releases an update?
As far as I understand you cannot download the SDK separately - and even if you could, I wouldn't recommend it. Using the bundled SDK+Xcode release is the best idea in my opinion, as it will be working for you out of the box. I know it's annoying having to download such a large amount of data for an SDK (not all of us have 100mbps pipes to play with!) but for ease of development, it's the way I'd recommend you go.
For those who have installed Xcode but do not have the iOS SDK, here is the way to download it without re-downloading Xcode:
Got to
Xcode > Preferences > Downloads
and select whatever you want to install.
Yes, contrary to what others say this is somewhat possible.
Method One
With this method you can download any iOS or OSX SDK and install it to XCode.
Download the desired SDK, bundled with XCode, from developer.apple.com/downloads
Once the package is done downloading mount the disk image. Right on the XCode application in the image and click on Show Package Contents. Navigate to:
/Contents/Developer/Platforms/
the iOS SDKs are in:
iPhoneOS.platform/Developer/SDKs/
the OSX SDKs are in:
MacOSX.platform/Developer/SDKs/
and the iOS simulator SDKs are in:
iPhoneSimulator.platform/Developer/SDKs/
To install one of the SDKs simply find XCode.app and place the SDK in the appropriate folder of the XCode.app package.
Method Two
With this method you can only dowload iOS simulators and iOS simulator SDKs.
Open XCode and in the menu bar click on XCode > Preferences. In the preferences dialog select the downloads tab and select the simulators you would like to dowload.
Unfortunately, no. Apple only provides the SDK as a bundled package.
They quite often include fixes and updates in the bundled version of xcode. I guess this is a good way for them to "force" people to use the latest point release of xcode.
The answer to the question being asked is, I think, that it is not possible. However, there is a highly related question (with a more interesting answer), how to use different/nonresident iOS SDKs with a particular version of Xcode? This does require downloading some other Xcode (to gain access to some other iOS SDK).
This issue has been a passion of mine for approximately the last 10 years, since I enjoy the stability of (or, at least, predictability of known misbehaviors in) a familiar IDE (i.e. Xcode) version. I last investigated the solution to this issue 3 years ago, and it was slightly more involved than the solution from 5 or so years before that. Here are my notes, from 2017:
SDK
What the development environment treats as the target device, e.g. compilation, IDE behaviors like displaying interface definitions/headers and code completion).
The "Base SDK" (in the "Build Settings" of a target in a project, which is possibly contained by a workspace) setting defaults to "Latest iOS", which resolves to a specific iOS version based on the contents of the Xcode app package directory
<app-package>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
A version of the Xcode application will ship (via Mac App Store or a disk image from developer.apple.com) with only one SDK. The above path will contain a directory named iPhoneOS.sdk and an alias (symbolic link) targeting this directory that is named according to the SDK version (iPhoneOS10.0.sdk -> iPhoneOS.sdk)
No application-provided means (i.e. preference of other UI affordance) for altering this characteristic.
While the plural form of the directory name (SDKs) seems like a vexing/mocking choice, you can modify the contents of this intra-app-package directory to include symbolic links to SDKs contained in other versions of Xcode.
This appears to only work in the forward direction, i.e. using a newer SDK in an older Xcode (e.g. iOS 10 SDK in Xcode 7). This direction has always met my historical needs. Only recently have I attempted to go backwards (make a newer Xcode use an older SDK, e.g. iOS 8.4 SDK in Xcode 7), and I discovered that recent Xcode installs (versions 8.0 and 7.3.1 on a 10.11.6 system) ignore symbolic links to older SDKs (i.e. they do not appear in a target's Base SDK popup menu – screen shot of Xcode 7.3.1 ignoring the iOS 8.4 SDK symlink).
UPDATE (new details): I double-checked my home machine (which I had used for additional multi-SDK experiments) and found that older SDKs do appear in the Base SDK popup. Mysterious! This is a 10.10.5 system, running Xcode 7.2.1 (which ships with iOS 9.2 SDK), editing a different (non-iovation) Xcode project, and the iOS 8.2 SDK (from Xcode 6.2) will display in the popup. Obviously, there are numerous differences between the setup, and I have no idea which variables cause the difference in behavior.
MYSTERY SOLVED: Recent Xcode installs (the aforementioned versions 8.0 and 7.3.1) include a MinimumSDKVersion key in the …/iPhoneOS.platform/Info.plist file. This key appears to be set to the SDK that ships with Xcode (i.e. inside the app package), and, consequently, blocks Xcode from recognizing older SDKs. I was first keyed onto this minimum-version mechanism from the xcodebuild command-line tool, which was printing out, "Skipped SDK <sdk-path>; its version (8.4) is below required minimum (10.0) for the iphoneos platform."
Editing MinimumSDKVersion plist key (e.g. making it 8.0) allows for the display and selection of older SDKs!
The fact that Apple rigidly binds SDK version to Xcode version has always bothered me. Oftentimes, I would prefer to add an SDK to an existing Xcode install, rather than updating the entire Xcode environment simply to gain support for a new version of iOS. Admittedly, bringing everything along in lock-step fashion (app, tools, device and OS support) does seem like it should simplify support issues for Apple, and, perhaps, they believe this conjoined progression also simplifies things for 3rd party devs (no options to fret over, just update the app).

Resources