Xcode 4.2: Build for Archive is good, but Archive fails with errors - iphone

I am trying to build my app and submit it to the App Store but Xcode keeps giving me errors when trying to do that.
When I build and run in the simulator it works, when I build and run for a device it works, when I try to use the build for archive option it works, when I actually try to archive it it will fail with 9 or 11 errors depending on (IMHO) what time of day it is.
Anyone have any idea why? I tried following some other tips such as deleting the project folder in ~/Library/Developer/Xcode/DerivedData
And another user said to clean the build folder but that option is grayed out in the menu bar.
Anyone know of any other solutions?
All my errors are file not found errors, I am using Three20 so the errors are:
'Three20Core/TTCorePreprocessorMacros.h' file not found
'Three20Core/TTDebug.h' file not found
'Three20Core/TTCorePreprocessorMacros.h' file not found
'Three20Core/TTGlobalCore.h' file not found
../scripts/Protect.command: line 23: cd: /Users/[username]/Library/Developer/Xcode/DerivedData/TTCatalog-gcnbfpwscygfrmdhcfiahsatpdba/ArchiveIntermediates/pr/BuildProductsPath/Release-iphoneos/../three20/Three20Network: No such file or directory
'Three20UICommon/private/UIViewControllerGarbageCollection.h' file not found
'Three20Core/TTGlobalCoreLocale.h' file not found
'Three20UICommon/private/UIViewControllerGarbageCollection.h' file not found
../scripts/Protect.command: line 23: cd: /Users/[username]/Library/Developer/Xcode/DerivedData/TTCatalog-gcnbfpwscygfrmdhcfiahsatpdba/ArchiveIntermediates/pr/BuildProductsPath/Release-iphoneos/../three20/Three20UICommon: No such file or directory

The error seems to be path issue in environment variables.
Just carefully follow the steps mentioned in integrating Three20 library # https://github.com/facebook/three20
( use The Second option to add it to your project manually)
Make sure the configuration added to All Configuration (Debug, Release, Distribution(if exists).
Also Make sure your Xcode preference are as below
xcode->preferences->locations
Select Derived Data->relative
Select Advanced -> Legacy

Related

Cocoa Swift: Launch At Login not working & throws error in Xcode?

I am using https://github.com/sindresorhus/LaunchAtLogin as it reduces the hassle to implement Launch At Login from Scratch.
I did follow all the instructions in the README as follows -
Made a Podfile & installed with pod install
platform :osx, '10.12'
target 'myApp' do
use_frameworks!
pod 'LaunchAtLogin'
end
Added a new "Run Script Phase" below "Embed Frameworks" in "Build Phases" with the following:
./Pods/LaunchAtLogin/LaunchAtLogin/copy-helper.sh
But I get the error
cp: /Users/username/Library/Developer/Xcode/DerivedData/myApp-bcrytpktfvzflmexubmyosnhzksq/Build/Products/Debug/myApp.app/Contents/Frameworks/LaunchAtLogin.framework/Resources/LaunchAtLoginHelper.app: No such file or directory
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure
As you can clearly decode from the error LaunchAtLoginHelper.app cannot be found at /Users/username/Library/Developer/Xcode/DerivedData/myApp-bcrytpktfvzflmexubmyosnhzksq/Build/Products/Debug/myApp.app/Contents/Frameworks/LaunchAtLogin.framework/Resources/ that's why the build is failing.
How do I generate that or what should I do to sort this thing out because this makes Launch At Login not work?
I also made a simplest demo for the app to see if it works but it doesn't - https://github.com/deadcoder0904/LaunchAtLoginPod
PS - I have also code signed the application as I did follow this & checked it with codesign -dvv /Applications/myApp.app & it returned Build Time perfectly.
I had the same issue while using Carthage instead of CocoaPods. Currently, there seem to be lots of open CocoaPods' related issues in this project's repository so you might consider trying Carthage and follow these steps.
I solved this issue using the following steps:
In XCode, under Build Settings, under signing, make sure Code Signing Identity is set to either Sign to Run Locally or any other form of actual signing
Use this tutorial to install Carthage
Follow the install and usage of the package, using Carthage, as appears in the README file here: https://github.com/sindresorhus/LaunchAtLogin
Delete all of the contents in DerivedData
To make sure, also clean the project: (Product -> Clean Build Folder)
In your project's folder, execute carthage build
There should now be a new folder inside your project's root folder named Carthage. Inside, there is a Build folder. Search for the file LaunchAtLogin.framework.dSYM (note the .dSYM extension)
In XCode, under Build Phases, in Embed Frameworks step, drag and drop the .dSYM file (see image below)
Change the destination to Products Directory (see image below)
Check the Code Sign On Copy checkbox of this framework (see image below)
Add another step New Run Script Phase, make sure it runs the native shell (/bin/sh). Inside, add this line: exec "${PROJECT_DIR}/Carthage/Build/Mac/LaunchAtLogin.framework/Resources/copy-helper.sh" (this is the line that appears in the repository) - (see image below)
Make sure that the script appears after the embedded framework
Build and run
Not exactly an answer but found an alternate solution.
I couldn't solve this with CocoaPods but I did make a simple demo with Carthage & it worked.
Here's the link for the interested - https://github.com/deadcoder0904/LaunchAtLoginCart
Edit:
Found the solution thanks to Ferruccio
Add a new "Run Script" below "[CP] Embed Pods Frameworks" in "Build Phases" with the absolute path to copy-helper.sh.
For simplicity, you can just drag & drop copy-helper.sh. Drag it inside label Shell. Then change Location to Absolute Path
Also you can try https://github.com/deadcoder0904/LaunchAtLoginPod as a simple working demo.

"Symbols Tool failed" error while exporting iPhone application with APP Store Profile

After successful Archive, while exporting the Archive to "Save for App Store Deployment", I got the following error:
"Symbol Tool Failed".
During the Export sequence, I have observed, "Binary and Entitlements" section, has two entries.
1) The app store targetAppName (5 Entitlements). with valid Provisioning Profiles.
2) One of the build files FTALDeviceDetailsViewController.o (o Entitlement) with Provisioning Profiles (none)
I bet the second entry here is what is causing the error. Here is the error log:
Any one know how to remove the second entry?
I found another interesting information, regarding this issue:
Unser Archive folder
ActiveLife\ 11-12-14\,\ 3.56\ AM.xcarchive/Products/Applications/ActiveLife.app/
I found following 3 files those are generated in response to second Entitlement file:
FTALDeviceDetailsViewController.d
FTALDeviceDetailsViewController.dia
FTALDeviceDetailsViewController.o
I have manually deleted these 3 files, and now I am able to generate .ipa file.
Now still mystery to me is; why are these files generated and how to fix the root of the problem?
I experienced the same "Symbols Tool Failed" issue yesterday. With the following more detailed error:
Archive upload failed due to the issues listed below.
Unable to validate your application.
The path '/var/folders/c6/wfv094t921j7q1bzhht5wtdnhvjv1/T/XcodeDistPipeline.blK/Packages/XXXXXX.ipa' does not contain a file.
The cause of the problem was that a third party library (*.a file) had accidentally been included in the "Copy Bundle Resources" "Build Phase". The give-away that this was the problem was that this *.a library appeared in the list of "Binary and Entitlements" screen when submitting the upload:
Ultimately the third party source code had been added to our workspace as a "Folder Reference" and someone had checked the 'target membership' for that folder. This resulted in the the third parties libary folder (which contained the *.a) being included in the "Copy Bundle Resources". Simply unchecking the 'target membership' box for the folder fixed the issue.
The reason for the issue is, some how FTALDeviceDetailsViewController.m file is ended up Copy Bundle Resources causing this is be treated as separate target.
When I delete the file from the Copy Bundle Resource, every thing worked as expected.
Now the mystery questions to me, what are .d .dia generated? This is up for further study.
Unchecking "Upload your app's symbols to receive symbolicated reports from Apple" option fixes the "Symbol tools failed" error when you Archive the app in Organiser window of Xcode.
I faced this too, and trying to find something wrong with the copy bundle resources, as the previous answers, I found a folder being copied, removing it solved the problem.
Basically some framework has been added to Copy Bundle Resources. Remove it to resolve the issue!
Could also be that there is a framework unnecessarily added in 'Embed Frameworks' in Xcode Build Phases
"Symbols Tool Failed" error can also be caused by this.
Xcode 13.1 - Check BuildTarget -> General -> Frameworks and Libraries. If something is marked as Embed And Sign it may need to be changed to Do Not Embed.

Xcode: Warning: Multiple build commands for output file AND error: unable to open executable ''

I've been reading countless other posts and trying numerous fixes, but nothing has worked for my problem. I'll preface this by saying that I haven't used Xcode on this Macbook in some 2-3 months. This is the only project (out of the 4 or so I've tried) that has this problem. The first thing I did after opening Xcode was I changed the name of the project as well as a .h and .m file. I did all of this through Xcode, not Finder.
Nothing is appearing in the Navigator in red text which would indicate that it can't be found. Here is what I've already tried (many times).
Close/Open Xcode.
Clean both the project and build folder.
Delete Derived Data folder.
Ran a Disk Utility to repair permissions.
Restarted the computer.
Tried different combinations of Code Signing.
Delete App from device.
Searched through project for any duplicate file names.
Here is the warning verbatim:
Warning: Multiple build commands for output file /Users/jinser/Library/Developer/Xcode/DerivedData/Landmarks-bgnzcomxftpffiezmwocaqdydrlj/Build/Products/Debug-iphoneos/Landmarks.app/Landmarks
and here is the error:
GenerateDSYMFile /Users/jinser/Library/Developer/Xcode/DerivedData/Landmarks-bgnzcomxftpffiezmwocaqdydrlj/Build/Products/Debug-iphoneos/Landmarks.app.dSYM /Users/jinser/Library/Developer/Xcode/DerivedData/Landmarks-bgnzcomxftpffiezmwocaqdydrlj/Build/Products/Debug-iphoneos/Landmarks.app/Landmarks
cd "/Users/jinser/Desktop/Kevin/Cocos2D Projects/ARSpaceships"
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/usr/bin/dsymutil /Users/jinser/Library/Developer/Xcode/DerivedData/Landmarks-bgnzcomxftpffiezmwocaqdydrlj/Build/Products/Debug-iphoneos/Landmarks.app/Landmarks -o /Users/jinser/Library/Developer/Xcode/DerivedData/Landmarks-bgnzcomxftpffiezmwocaqdydrlj/Build/Products/Debug-iphoneos/Landmarks.app.dSYM
error: unable to open executable ''
This is Xcode 4.2 on Mac 10.6.8. Please, any advice would be appreciated. I am losing my mind.
Thanks.
So to whoever runs into this problem and all of the other solutions out there do not work for you, make sure you don't have a project folder that shares the same name as the project. For instance, my project is called Landmarks and I had a folder inside the resources also called Landmarks. Once I renamed the folder, all was well.
Not my answer, but LargeGlasses provided the real answer (for me) in a comment, I've formulated it as an answer in its own right because I can't Up Vote the comment.
any two files within your project that have the same name will cause this warning.
In my case, I had an icon with the same name in different subfolders, one was used by the App and the other was part of my help resource located in a different folder. The solution is to just rename one of the two.
All credit and my thanks for this answer to LargeGlasses.

lexical or preprocessor issue file not found occurs while archiving?

I am new to this iPhone development and i have almost completed my first application but when i try for creating an archive it gives an error lexical or preprocessed issue file not found But it runs fine in simulator and also has also tested on device. I have included SDwebimage architecture for lazy loading of image in table view.Can any tell me what is the issue?
Few things to try, Ensure the Framework and all it's headers are imported into your project properly.
Also in your Build Settings set YES to Always search user paths, and make sure your User header paths are pointing to the Framework.
Finally, Build->Clean and Restart Xcode.
Hope this helps !
UPDATE: According to SDWebImage's installation, it's required you make a modification to Header Search Path and not User header paths, As seen below.
Have you done this as well? I suggest slowly, re-doing all the installation steps from the beginning.
Spaces in a folder name in your header search path can cause this problem. Make sure the folders in your project do not have spaces in their names.
My project was building fine until I updated to Xcode 10.1. After the Xcode update, started getting Lexical or preprocessor Issue errors on build. Some XCDataModel header files could not be found.
This fixed the issue.
Go to Build Settings, Header Search Paths
Change the appropriate value from $(SRCROOT) non-recursive to recursive.
This ensures that subfolders are also searched for headers during build.
I had this same issue now and found that my sub-projects 'Public Header Folder Path' was set to an incorrect path (when compared with what my main project was using as its 'Header Search Path' and 'User Header Search Path').
e.g.
My main project had the following:
Header Search Paths
Debug "build/Debug-iphoneos/../../Headers"
Release "build/Debug-iphoneos/../../Headers"
And the same for the User Header Search Paths
Whereas my sub-project (dependency) had the following:
Public Header Folder Path
Debug "include/BoxSDK"
Release "include/BoxSDK"
Changing the 'Public Header Folder Path' to "../../Headers/BoxSDK" fixed the problem since the main project was already searching that folder ('../../Headers').
PS: I took some good screenshots, but I am not allowed to post an answer with images until I hit reputation 10 :(
I had this problem after changed project name. I used all the methods mentioned on the internet but still doesn't work. Then I realized that all the header files not found was from cocoapods, so I re-installed the cocoapods using pod install, and thus solved the problem.
Hope this could help.
In my case I was developing a framework and had a test application inside it, what was missing is inside the test application target -> build settings -> Framework Search Paths:
The value needed to be the framework path (the build output - .framework) which is in my case:
"../FrameworkNameFolder/" - the 2 points indicates to go one folder up.
Also, inside the test application target -> Build Phases -> Link Binary With Libraries:
I had to remove the framework file, clean the project, add the framework file again, compile and this also solved the issue.
The new version contain fix for this, feel free to update.
Or you can just replace
#include "iPhone_View.h"
with
#if UNITY_VERSION < 450
#include "iPhone_View.h"
#endif
Delete the unit testing from your project follow the below steps this will solve the issue.
select your project from the project navigator to open the project editor. From the target delete the test from the left side of the project editor and press the Delete key.
I know this is old, but I'm gonna chime in anyway because it may be useful to someone. If you can still see the file in Finder, then click on the file in your project and delete it, selecting "remove references" and not "move to trash".
Once the reference is removed, drag and drop the file from finder into your project again and it should sort itself out.
Just adding another thing that worked for me :
react-native link
Evidently my ReactNative files were no longer there. I could figure that out by clicking on
Build Phases -> Link Binary with Libraries ->
Then right clicking a file I knew was responsible for React, and clicking Show In Finder .
But nothing opened. So assuming the library went missing, I just ran the above command which relinked everything again.
Also if you havn't, try :
rm -rf node_modules/ && npm install
This happened to me after I renamed a file. For some reason it was still looking for the file with the old name. What I did was create the file that it was complaining about and added to the project. Then I did a Project->clean, then Project->Build and verified the error was gone. Then I selected the newly added files and deleted them. This removed all references and I no longer see the error.
I fixed mine. The fb sdk downloaded (from my browser) as 'FacebookSDKs-iOS-4.22.0' -- I just had to rename the folder to FacebookSDK. So now in Build
Settings --> Framework Search Paths
the path looks something like /Users/.../Documents/FacebookSDK (where as before it was /Users/.../Documents/FacebookSDKs-iOS-4.22.0)
Hope this helps!
For what it's worth, my problem was completely unrelated to the error Xcode was giving. I stumbled onto a solution by deleting the .h reference, compiling, adding the reference back and compiling again. The actual error then became evident.

Command /Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

I'm trying to do an application reading pdf using pdf kit in Xcode 4.3 but it gives me the following error
ld: duplicate symbol _OBJC_METACLASS_$_OverlayManager in /Users/dt4it/Library/Developer/Xcode/DerivedData/MyPdf4-bmkjglhhvneluqcbwpceiqjvdcmq/Build/Intermediates/MyPdf4.build/Debug-iphonesimulator/MyPdf4.build/Objects-normal/i386/OverlayManager-D0866CFD31A05E68.o and /Users/dt4it/Library/Developer/Xcode/DerivedData/MyPdf4-bmkjglhhvneluqcbwpceiqjvdcmq/Build/Intermediates/MyPdf4.build/Debug-iphonesimulator/MyPdf4.build/Objects-normal/i386/OverlayManager-B31AE7412100AF6D.o for architecture i386
Command /Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
any help please ??
Project Settings > Under "Targets", select your project > Build Phases >
open "Compile Sources" and "Copy Bundle Resources". Check if any files are listed in red color. If so , just delete it. Then clean and run.
Worked for me.
Do a clean. product > clean . Terminal purge & reboot didn't work for me, cleaning did.
I had this same error and nobody seems to have an answer on StackOverflow that actually works. My problem was when I tried copying a project that was in a team repository. Turns out, in the ignore file, all files with the extension of *.pch were ignored from repository commits. This means that when I went to pull the project from the repo, the .pch file was missing, thus throwing this error.
Fortunately I had a copy of the project still and was able to just copy the .pch file over and I was then able to compile just fine.
Hope this helps?
Go to target preferences, summary tab, find "Deployment target" and increase it.
deleting ~/Library/Developer/Xcode/DerivedData helped me.
reference : link
I face this problem too. And ofc I looked for help in SO instead of use the common sense and check the error message.
The last part of the error message was the same as you.
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 11
But few lines above I found:
In file included from /Users/Ricardo/Documents/XCode/RealEstate-Finder-v1.2/RealEstateFinder/RealEstateFinder/RealEstateFinder-Prefix.pch:26:
/Users/Ricardo/Documents/XCode/RealEstate-Finder-v1.2/RealEstateFinder/RealEstateFinder/Config/Config.h:174:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
http://www.myserver.com/apps/mobile/rest.php?id=12
Which points to my Config.h file.
Happy coding!
You have accidentally included the .m file OverlayManager instead of the .h file inside the actual OverlayManager class itself! Basically, he compiler already knows to compile the .m file, but when you #import it, the compiler tries to include it inline with that same source file, thus generating duplicate symbols. But your case is unique, seeing as you are #importing the .m of the actual class' .m file! It's recursively compiling your OverlayManager class.
The same thing happened to me and i found that i forgot to put the " at the end of the
#import "CPDConstants.h
so instead
#import "CPDConstants.h"
For me this error appears after cloning the project from a repository. Someone removed a white space from the projects name (renamed: "The Project" to "TheProject") which caused some Build Settings errors to unvalid paths.
Sometimes reading the whole error logs is not a bad idea....
Try this - click on the name of your project on the list of files/folders on the left in Xcode (at the very top of the list). Look at the "Targets" section on the left-hand side of the window to the right. Likely, there's two listed with the second being a "test" item. Right-click on that item and select "delete". Then try to run the project again.
This problem usually occurs when there are more than two versions of XCode are installed in which different Swift versions incorporated for Ex. XCode 6.4 and XCode 7.3 are installed which are running Swift 1.2 and Swift 2.0. By mistake you tries to compile code with icorrect version for Ex. your project in in Swift 1.2 and you tries to compile it with xcode 7.3. In this case drive data stores information for swift version but when you tries to compile code with correct XCode it gives error.
To resolve this
Delete drive Data
a. In Xcode select preferences
Once preferences are open click on Location tab and click on the arrow in front of the 'Drived data' path. It will open drived data folder
Quit Xcode
Delete all drive data.
reopen the project in correct XCode error is fixed !!!!!!
The thing to consider here is the *.pch file. If you're doing an include from an external library then you have to make sure you're doing the include after #ifdef OBJC and before #endif. If you try to do your include outside this condition this might be a cause of the compiler error.
Had this happen in a team using git. One of the team members added a class from an external source but didn't copy it into the repo directory. The local version compiled fine but the continuous integration failed with this error.
Reimporting the files and adding them to the directory under version control fixed it.
I too had this error. But in my case, and I'm sure I'll be a one off here, I had accidentally deleted main.m when I hit the delete key after the app had crashed on the iPhone simulator.
After a crash, Xcode shows the main.m file and when I had hit delete, I had accidentally deleted the main.m file from my project, as it is easy to do when a file name is highlighted, not the code in the detail view.
Main.m normally resides in a group or folder named supporting files in the project file manager. I had not noticed this happened until it failed to build and run next time around and then I had to re-read the error message more closely and saw it said main.m is missing.
Thank you all for your input, but just in case there is someone in my position check for any file names in red showing missing files and restore them from a backup if you have it.
Adding the missing files(files in red color in Xcode->target->Build Phases->compiled sources) to the target folder resolved the issue for me.
My problem was that under Build Phases -> Compile Sources, I added a compiler flag for a file, but I had misspelled it. It was supposed to be:
-fno-obj-arc
to show that this file does not use ARC.
May be it will be helpful for someone:
I had the same error after deleting several files from project. After having deletes committed in git repository this error has gone...
Xcode 8
#Spoek's answer is right,
But If you won't find file in red color, then find the one with low opacity,
see this image,
The first one is there but second one is note there, so delete it.
My case, I fix it by:
Go to Build Phases and check Compile Sources files, check if it has duplicate file, just keep one.
In my case it was a duplicate Swift Flag entry inside my Target's Build Settings > Other Swift Flags. I had two -Xfrontend entries in it.
In my case,
Build Phases -> check Compile Sources files -> delete xxx.swift files that xcode says "can't find "xxx.swift"
This happened to me and it took me an hour to find it. In my case I had typed too fast and did:
[seld method];
instead of:
[self method];
Seriously! I don't know why it didn't catch this in a more recognizable way. But it was of course looking for a class called "seld".