How to make Xcode Archive use the right configuration information? - xcode

My Mac app has two Targets. When I attempt to Archive the second Target, Xcode always uses the configuration info for the first Target (Bundle ID, Version, and Build) even though I have selected the second Target.
By configuration I mean the "General" options displayed when clicking on the project name in the Project Navigator.

I was using the wrong scheme (whatever that is). To set the right scheme, use the Scheme menu (just to the right of the square Stop button on Xcode's menu bar).

Related

Xcode 11, where can I manage Build Phase?

I've migrated my app into Xcode 11.
I want to remove legacy resources that copied at Build Phase, but I can't find old Build Phase menu.
Please make sure that you have selected Target instead of Project.
The problem is that you have the project selected (in the "project and targets list", which may be a collapsed pane for your Xcode).
So first, make sure the button to the far left of the "Info" tab shown in your screenshot is toggled on (so you can see your project and targets list).
Then simply select a target. Now you'll see the Build Phases tab. Only the targets of a project have build phases.
Note: If you don't like to keep the targets list shown, you can simply use the popup menu next to the pane's toggle button - which appears when the pane is not shown - to toggle from project to a target.

How can I skip code signing for development builds in Xcode?

Whenever I build my Xcode project, after compiling all my code, it takes forever to finish "signing product." (I believe it's because the project includes about 200 MB of resources that need signing.) I would like to skip the code signing during development, so the build can finish faster. How can I do this?
As of Xcode 10, here is how to turn off code signing for a macOS app:
Select your project in the project navigator.
Select your app in the list of targets.
Click “Build Settings”.
Click “All”.
Click “Levels”.
Type “identity” into the search field.
Click on the Code Signing Identity row, under the column for your app target (labeled “test” in my example). That cell of the table might appear empty.
In the pop-up menu that appears, choose “Other…”.
In the popover text box that appears, delete all text so the box is empty.
Press return to dismiss the popover.
With this setting, Xcode will not sign your app target.
To turn the code signing off, go to your project and target "Build Settings", search for "Code Signing Identity" change its value to "Don't Code Sign" in both of them.
To make this effective you need to change this value in the Project and all of the Targets separately.
If someone uses CMake (for multi-platform projects) to disable code signing for specific target I used this:
set_target_properties(MyAppTarget PROPERTIES
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
OUTPUT_NAME "My nice application name"
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_BUNDLE_NAME "My nice application name"
MACOSX_BUNDLE_INFO_PLIST path/to/Info.plist
MACOSX_BUNDLE_BUNDLE_VERSION ${MY_APP_VERSION}
MACOSX_BUNDLE_LONG_VERSION_STRING "My nice application name v${MY_APP_VERSION}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${MY_APP_VERSION}"
MACOSX_BUNDLE_GUI_IDENTIFIER "com.my.app"
MACOSX_BUNDLE_COPYRIGHT "(C) 2019 My Company"
MACOSX_RPATH TRUE
MACOSX_FRAMEWORK_IDENTIFIER com.myapp.bundle.id
XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "#loader_path/Libraries"
RESOURCE "${RESOURCE_FILES}"
XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME TRUE
XCODE_ATTRIBUTE_EXECUTABLE_NAME "exec_name"
)
You might try moving your resources to a separate bundle target, then adding the .bundle product of that target to your app’s “copy bundle resources” build phase — ideally the app build should then be able to use the bundle’s signature (which will only need to be regenerated when the bundle’s contents change) instead of having to re-sign the resources individually.
FWIW for iOS builds that you build into your simulator, you don't need code-signing. Hence no need to skip it.
You only need code-signing/Provisioning Profile on physical devices. I'm not aware of how you can skip them.
This other answer that I have not tried suggest that you can build without code-signing if you jailbreak but I'm not sure if it's answer is valid now

Remove -cal target from Xcode

Setting up an Xcode project for testing with Calabash. How can I remove the -cal target completely. There is already a -cal target in the repository that is quite old. I would like to set up fresh but it seems to create another -cal target when I run setup. Any thoughts? Xcode 6.
The -cal schemes appear in 2 separate locations in Xcode. The first location is to the right of the build button. Click on the -cal scheme then go to Manage schemes and delete it from there. To get the second location, click on the Show Project Navigator and then choose the name of the -cal scheme you used in the left pane (there should also be one called Pods that is automatically generated). Then look under Targets in the Build Settings pane and you will be able to delete the second -cal scheme.

Build Phase Tab Hidden or Missing

I'm probably asking a very elementary Xcode question, but here it goes. My layout has no 'Build Phase' tab. I might have inadvertently changed my layout. A lot of tutorials state that you should go to the Build Phase tab and link to a library. Well, I've Clicked on the Target, and the File under the Target, Searched the Toolbar, searched the project settings, Info. When I right click on the Target File I get a list including "Copy Build Phase" and Add Build Phase, but that's not giving me access to the Build Phase Tab. I've tried 'reset to default or factory layout'.....Build Phase Tab. How can I display the layout with a Build Phase tab in the toolbar, and save it to utilize in my projects? By the way I'm using XCode 3.2 maybe it's a version limitation?
It sounds like those tutorials are for Xcode 4. For your version, if you open the target in the sidebar, there should be some groups. Those are your build phases. Just drag the library into the one that says something like "Link Executable", or click the checkbox to add it to your target and it should go there automatically.

Where are my targets in Xcode 4?

In Xcode 3, I had a list of targets in the left column. They're not there anymore. There's a list in the Scheme pull-down, but I can't find them anywhere else. Have they changed name to "Schemes"?
Click the button as below images
Targets are still there. Click on the project (the very first object in the tree) in the project navigator and you'll get a view with project settings on the right and targets on the left.
Click on the top level item in the left hand project view - it will show you the project and the targets in the main pane - along with their configurations
No, targets and schemes are not the same thing. Your targets are still there: in the navigator in the left, click on the Project icon (it says "1 target, iOS SDK 4.3" or something similar underneath the usual .xcodeproject icon). THe main view now shows the project editor, where you can see and edit all your targets.
Schemes are basically ways to aggregate targets in useful ways when performing common actions like building and testing.
Yep, they are inside "Schemes" now. Each scheme can contain differing targets/build configurations.
If you click the dropdown and choose "Edit Scheme..." where your targets used to be in Xcode 3, then click "Run AppName..." or "Test" in the left side tree, under the "Info" tab you'll find the Build Configuration dropdown that contains Debug, Release, etc. in addition to the target Executable.

Resources