Xcode Scheme with multiple targets creates Generic Xcode Archive - ios

Ok, I am almost certain that this thing worked before but I am stuck now...
I have a workspace with multiple targets which I want to archive and submit to appstore simultaneously.
I have created a new scheme, I have all targets selected in there for Archive and I try to execute Archive in order to make all targets to IPAs
I always end up getting an Xcode Generic Archive. The only case I am getting an IPA is to select Skip Install = YES for all targets but one each time, which I suppose it actually means to build just one target so there is no meaning to multi target scheme.
Any clues about that? I checked the size of this Generic Archive and it looks like all apps combined in one file.

Indeed Apple confirmed that this is "impossible because archiving step in a scheme is designed to produce only one archive" and they asked me to build every target separately. I wonder if I can archive every scheme in a workspace automatically from command line to produce the desired result.

In order to create an IPA file using Xcode, we can use commands too. One can follow these steps:
1. Navigate to the App folder in Terminal
2. Run Cordova build command using "cordova build iOS" command
3. Open your iOS Project in Xcode.
4. Choose Product -> Clean. Then Archive.
More detailed screenshots are available here.

Related

Fastlane upload_to_testflight lane is looking for target selection manually

Im trying to build and upload an ipa file to testflight using Fastfile, but when i start fastlane command to run, there is pop is coming and that is looking for target selection. Hence it still needs a manual intervention however i aimed to automate the deployment process.
Here it is the screenshot which im telling the actual issue.
I tried using SCHEME to pass TARGET of Xcode workspace , however it still requires to provide target selection manually.
Is there any way to automate the target selection for upload ipa file to Testflight?
Looks like you are missing the target from the parameters on the call:
version = get_version_number(
xcodeproj: "Project.xcodeproj",
target: "App"
)
The docs note the properties here.

How to archive/export Framework in Xcode?

I have a project with a framework target, but when I archive, the framework does not show up in organizer. I checked apple for documentation, but only found reference for static libraries.
Has anyone experienced this before?
Here are screenshots of my current scheme settings
Go into your framework and build.
cmd+b
You will find in your products YOUR_FRAMEWORK.framework
Right click on "YourLibrary.framework" -> Show in Finder
Now you can share/import your library.
Attention: Don't link/reference to this path because the framework is stored in Derived Data.
The only thing you should do is build the target,then show Products in finder ,you will see it.
The steps are documented by Apple here
Set up the project
To set up your project for creating an XCFramework, ensure your Xcode project has a scheme that builds only the framework target and its dependencies.
Configure these build settings on your target:
Set the Build Libraries for Distribution build setting to Yes. For Swift, this enables support for library evolution and generation of a module interface file.
Set the Skip Install build setting to No. If enabled, the built products aren‘t included in the archives.
Leave the Architectures build setting unset. The predefined value configures the target to build a universal binary for all the possible architectures the target platform uses.
Then you can use Archive to build your framework for Release.
Once built, the Organizer window will open.
You can then click on Distribute Content -> Build Products and export your framework.
Archive framework
Product -> Archive
//or
xcodebuild archive
[Archive location]
Xcode v12 does not have such problem and when you try to archive a framework Xcode prompt you to corresponding Archives window
Archive is an action from Scheme[About] which is competitor for Build action. Archive includes Build with additional logic. For example Archive is used for XCFramework[Example] which additionally can contains .dSYM and .BCSymbolMap files
For usual purposes you can just use Build action, it creates a corresponding .framework file in a Build location[About]

Xcode project scheme is not currently configured for the test action

I am trying to run an Xcode unit test for my iOS application. I am willing to do it on an iPad connected via USB to a Mac. I am trying to run the test from the command line in order to trigger it from Jenkins later on.
Below is what I'm currently typing into the command line and the error I'm getting. Please help.
The code:
xcodebuild test -scheme MyApplication -destination "platform=iOS,name=iPad"
The error:
Scheme MyApplication is not currently configured for the test action
For me the problem was that no tests were added to my scheme:
By adding test bundles to my scheme via the '+' button then the scheme could be built by Xcode and xcodebuild.
For everyone struggling with this problem.
My solution was to:
Select Test Target
Manage Scheme
Select Run in the left menu
Select Info in the tab
Choose Executable Target from the dropdown menu
Hit Close.
Fixed this up by removing duplicate schemes from Xcode. The schemes can be added/removed/shared/edited in Xcode via Product -> Scheme -> Manage Schemes.
Please follow following steps to resolve this error.
Select your project scheme at the top.
Click on Manage Schemes.
Select your test target in the popup.
Make sure to click on Edit button at the bottom left of popup.
Select Build.
Click the checkbox below "Run"
Close the popup.
You should check your workspace data on Jenkins and see which *.xctest is already uploaded. Then you have to rename your UI/Unit test target to that *.xctest data in your xcode project like what you
have on Jenkins and then push again.
OR wipe out your workspace from Jenkins and push all data again with new UI/Unit test target again.
(Of course you have to ensure that you have already made a scheme for project.)
In my case I had no test file...
Here is a tutorial to perform UI Tests and create screenshots :
https://krausefx.com/blog/run-xcode-7-ui-tests-from-the-command-line
My problem was that the Tests.swift file was importing a module that no longer existed (I renamed the Targets for the project). Check to make sure all test files are importing currently existing modules.
I was getting this similar error, but none of the other solutions helped. Since the error was first noticed while running via Fastlane, I next ran xcodebuild manually using this command to mimic the same.
xcodebuild -workspace Noname.xcworkspace -scheme Noname -enableCodeCoverage YES build-for-testing
I then saw errors regarding: Signing for "Noname-Dependency" requires a development team.
I also so reference to a macosx signing error, which I cannot sadly reproduce having since fixed the issue.
To fix the issue, under Signing & Capabilities for the Target I selected None and then under General I unchecked Mac, as we are not needing/using that but it was selected by default when creating this new project (CocoaPod).
Oddly enough, I added back Mac and things still kept working. I think that there is a oddity with the Xcode project file and/or scheme file(s) such that when you tinker enough with it -- things get reset/fixed.
I had a test plan set up (xctestplan).
I needed a separate configuration for the tests (the test plan) in addition to "Shared Settings".
Please also make sure that the test plan (under Xcode scheme settings) includes a test target AND a configuration.
Screenshots attached:
In my case, it was failing intermittently with this error, turns out I had two schemes with the same name and Xcode sometimes picked the wrong one, so make sure you do xcodebuild -workspace "MyWorkspace.xcworkspace" -list to see all your schemes and find out if you have repeating names.
Your test plan should have at least one custom configuration.
Go to Manage Schemes.
Delete all schemes and click on Autocreate Schemes.

Why are static library symbols not included in dSYM during archive?

We have a pretty major application suite for a client with a couple application targets utilizing several static libraries that we made in house. All targets are contained in one XCode project file.
For some reason when archiving an application the dSYM file does not contain any debug symbols for static libraries. The result is when trying to symbolicate crash logs from field agents we cannot see what is going on inside those static libraries.
I attempted to create a new simple XCode project with one application target and one static library. Even then the debug symbols were missing. I fiddled with the build settings according to this https://github.com/TheRealKerni/QuincyKit/issues/91 without luck.
If I build FOR archiving the debug symbols are included. I ran dwarfdump on the resulting dSYM file and was able to see the symbols for the static libraries implementation files. However when I then attempt to archive the project the symbols are excluded.
Am I missing something? XCode version 4.4.1
I m using XCode 5.1.1 and was having the same problem.
The fix was to set "Strip Linked Product" setting under "Deployment" section to "No" for each dependent library project. For more detail, please see my post at
can i debug ios app installed from ipa archive
This appears to be fixed in a later version of XCode, currently using 4.6 and the problem went away.
If you are stuck using an older version then do the following:
Product > Build For > Archiving
Product > Archive
Open the built product from derived data, you can do this by right clicking on the Youapp.app file in Products group and selecting show in finder. Ensure you are in the Release-xxx folder. Copy the dSYM file generated there and replace the one produced by the archive process. To find where archived files are go to Organizer, Archives tab, right click on an item and show in finder.
Hope this helps.
By default, archive uses release build, which already stripe debug symbols. you can change archive build option to 'not stripe'.

Why does xcode archive succeed but create an empty .xcarchive file?

Background
I have an application I'm trying to archive and submit to the app store for approval. Part of the process requires the archive to be prepared and loaded using application loader. I used product-> archive and it prompts archive succeeded but it does not appear on the Organizer -> Archive tab.
Detail of Project build
1 app target, "AppName"
1 static library, cocos2d libraries (cocos2d v0.99.5-rc1)
Xcode Version 4.0.2
First steps
Setting "Skip Install" to "No":
Project
AppName target
cocos2d libraries
Setting skip install on the three allows me the archive to be built and show up(non-empty xcarchive) on the organizer. However, when I try to validate, it'll prompt:
"AppName" does not contain a single–bundle application or contains multiple products. Please select another archive, or adjust your scheme to create a single–bundle application.
I checked that the archive package contents include the cocos2d libraries within a directory "Products". According to some posts and the cocos2d forum, we're not supposed to submit that as part of the binary for approval.
Steps taken to the Zero KB .xcarchive
Since the static cocos2d libraries library should not to be included, I've changed the cocos2d libraries target to have skip install: "Yes". Now, if I archive the project it prompts build succeeded but it creates an empty .xcarchive file that cannot be seen on the organizer->archives tab.
I have the solution to my problem and if anyone else is facing the same problem here are the steps i took to fix the problem.
cocos2d library
-Set the skip install to YES for all configurations in your cocos2d library.
-Set the code signing identity to Don't code sign for all configurations. Static libraries are not code signed.
-Update the installation directory to /usr/local/lib.
app library
-Update the installation build products location to /tmp/$(PROJECT_NAME).dst
-Update the installation directory to $(LOCAL_APPS_DIR) (/Applications).
-Update the code signing identity section.
What worked for me was to delete the lines SKIP_INSTALL = YES; from the various *.pbxproj files.
Hat tip to this blog. (No instances of INSTALL_PATH found in our files.)

Resources