I've been trying to submit an app to the app store for a client (my first try) and have been running into various and sundry problems. I finally decided to create a new app name, recreate the developer provision profile and recreate the developers certificate.
I can now run it in simulator and debug on the device, but can no longer run it in release mode - it doesn't even compile. The error message is:
arm-apple-darwin10-gcc-4.2.1: /Users/me/Documents/iphone/QuizApp/CityGuide_Prefix.pch: No such file or directory
The reference to the "CityGuide_Prefix.pch" file would be a holdover from the app I based it on, and apparently did not rename correctly. I don't know why the problem showed up now.
At the beginning of the compile log there is a reference to this file:
ProcessPCH /var/folders/YN/YNuTu4omEDm9bUMfK4s5yU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/CityGuide_Prefix-etfgludtmplcfzcirudhxormhsna/CityGuide_Prefix.pch.gch CityGuide_Prefix.pch normal armv7 objective-c com.apple.compilers.gcc.4_2
And it also shows up under the gcc compile command under this parameter:
-c /Users/me/Documents/iphone/QuizApp/CityGuide_Prefix.pch -o /var/folders/YN/YNuTu4omEDm9bUMfK4s5yU+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/CityGuide_Prefix-etfgludtmplcfzcirudhxormhsna/CityGuide_Prefix.pch.gch
My question is, how do get rid of this old reference? And why did it work before?
Check the build settings for your target in release mode. You will find a GCC_PREFIX_HEADER directive stating the wrong precompiled header file name (CityGuide_Prefix.pch). Change it to the right value (which you can find inspecting the debug configuration).
If you don't find that directive for your target, check the general project build settings.
Alternatively, you can open your /project.pbxproj file and search for ".pch" (without quotes), in order to fix that value for the release configuration.
You should have a look into the Build Phases of your target and figure out the file is named there under Compile Sources. If so, remove it there.
Related
I'm getting following error during release build:
error: Entitlements file "projectname.entitlements" was modified during the build, which is not supported. You can disable this error by setting 'CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION' to 'YES', however this may cause the built product's code signature or provisioning profile to contain incorrect entitlements.
I can't find CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION on Google or Apple documentation, any ideas where should I use it?
I fixed this with Product > Clean Build Folder.
Ran into the same issue. You can set CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION as a User-Defined setting in Build Setting.
In Xcode click on your project target and click Build Settings.
Click the "+" underneath Build Settings and then "Add User-Defined Setting"
Set CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION to YES for debug and release (or whatever schemes you like)
Before you start modifying the build settings you can also try deleting the Derived data in your install or build directory.
If the project cache is found in the standard location below you can do an Xcode clean and it will get rid of this data.
/Users/your_user_name/Library/Developer/Xcode/DerivedData/Path_To_Project/
If you defined your own install or build paths then go to that specific directory and delete that cache. Xcode should provide you the path if that error happens.
If Clean Build Folder doesn't help, make sure you don't have the same workspace/project opened in multiple Windows or Window Tabs!
(Xcode allows to open multiple tabs via File -> New -> Window Tab)
I've actually run into this EXACT same Compile-time error when I did the following in GitHub Client:
**Discarded changes in my Git Repo for an entitlement file.**
It's imperative like suggested above, "Clean Build Folder" or add USER defined key CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION to YES.
I know it's been answered above but I wanted to document the reproduction steps that led to the aforementioned error.
Like others have posted, this is resolved by cleaning the build folder or setting CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION to YES.
However, after cleaning the build folder, one build will succeed but any subsequent ones will fail with the same entitlements error until you clean the build folder again. Obviously this isn't optimal since it adds ~2-3 minutes per build even for one line changes.
The second solution involving CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION does away with the entitlements error entirely but install on physical devices fails every other build until build folder is cleaned. Same outcome really.
Does anyone actually know why this is happening in the first place? I inspected my entitlements file before and after build.. Nothing is changing. Is this just an xcode bug that costs us all hours of our lives?
I'm importing a newer version of a custom framework LCCommLibrary that creates the LCConnection class and I'm absolutely perplexed why this will build but not archive after trying multiple things.
Making sure the targets are added (4 apps, 1 Test)
Cleaning and Restarting the Project
This does builds and runs to my iOS devices, but none of the targets will Archive.
Archive usually uses the Release build configuration while building/running on the device uses the Debug build configuration, this is the hint that you have an issue there.
I would say in your case you can to go into the target's build settings, then look at Other Linker Flags, Runpath Search Paths and Library Search Paths, expand them to show the Debug and Release configurations and then ensure you have the same settings for both of them, you'll most probably find something missing in release in one of those.
Finally found the issue. The culprit was framework that was included was a debug version of the framework. This causes Archive Schemes to throw this error since the archive uses the Release as the default.
The resolution was to open the LCCommLibrary Project separately, change the Framework Target's Run Scheme to Release, Run and Build, Locate the target framework, import and embed that back into main project file, and archive as usual.
I have created a custom scheme in Xcode, which loads a separate plist file and I use this build for testing the application. I've removed the Archive option from the build, so that I do not accidentally publish this development version.
My issue is that I cannot really debug this build and I am not sure why. While the default build works fine in the Xcode debugger, my scheme does not. The breakpoints work, but single stepping fails and print object commands also fail with unrecognized variable errors.
It does look like maybe some option would be needed to add debug symbols or so, but I can't find that after having tried a few things in the Xcode project options. Going back to the default Debug build is not convenient, because my new scheme has different plist options, used for testing. Btw, my new scheme was cloned from the debug one when I first made it.
Any ideas how to fix that ?
Turning off optimizations will allow you to debug the application even if in Release-Mode. Optimizations strip the executable and that is why you cannot debug the variables.
I recently update Xcode to Version 7.1, which included Swift 2.1. I installed Swift 2.1 with no troubles. After attempting to run my project, I realized that I needed to grab the latest version of Realm, since the previous version did not support Swift 2.1. I deleted the old frameworks and imported Realm 0.96.2. Whenever I run, I now get this error:
bash: /Users/userName/Library/Developer/Xcode/DerivedData/appName-ghiroqitgsbvfhdqxsscyokyoouz/Build/Products/Debug-iphoneos/appName.app/Frameworks/Realm.framework/strip-frameworks.sh: No such file or directory
I suspected the problem was with the script that is required if you wish to submit your app the the App Store, so I removed the Run Script Phase, added a new one, and copied the script from the Realm documentation site:
bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework/strip-frameworks.sh"
I thought that that would fix it, but it did not. I then thought that the problem may be in the Realm.framework or RealmSwift.framework files, so I removed them and re-imported them (Just in case I messed something up). Nothing changed. Does anyone know if there is a fix to this error?
Thanks!
-CodeIt
From the error message, it seems like, you didn't added Realm.framework and RealmSwift.framework to the Embedded Binaries pane, which you find in the General tab of your project, as shown below:
For further validation, you can check the tab Build Phases. It should look like below:
Note: Make sure that the run script phase comes after the Embed Frameworks phase.
Why is this script needed?
The vendored frameworks are not just single executables, but actually FAT binaries which are archives of linked executables on different architectures. This includes architecture slices for arm64 and armv7, which are necessary for deployment on the phone as well as i386 and x86_64 which are necessary for running the app in the simulator.
The strip-frameworks.sh script main responsibility is to take care of removing unnecessary slices. This reduces the final package size and is necessary for AppStore deployment because iTunes Connect rejects apps with simulator architectures.
More Details
The script works on base of the build setting VALID_ARCHS. Because that is changing the signed executable of the framework, it also needs to take care of code signing. Since introduction of bitcode, it also got further post processing as responsibility. It extracts the included *.bcsymbolmap files from the framework bundle and places them into correct path in the *.xcarchive.
The FAQ topic on Bitcode of PSPDFKit has a good explanation on what BCSymbolMaps are:
A BCSymbolMap is a lot like a dSYM for bitcode. Xcode builds it as part of creating the app binary, and also for every dynamic framework. It's required for re-symbolicating function/method names to understand crashers.
In my case, change the process order in Build Phases to solve
not OK
OK
Building an iPhone app, using:
Xcode 4.1
Base SDK iOS 4.3
Apple LLVM Compiler 2.1
I have started getting the following error:
fatal error: file
'/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/../lib/clang/2.1/include/stdint.h'
has been modified since the precompiled header was built
I have tried reinstalling Xcode and OS X - no luck. What's causing this?
First try a clean build via the Product -> Clean menu (as of XCode 4.6.2).
If that still doesn't work then open the Organizer (from the menu select Window->Organizer). Once the Organizer is open, select Projects from the toolbar at the top of the window. On the left is a list of projects, select the one you are having a problem with.
The details panel (to the right of the list) will display the project name, location, status. The row beneath that shows where the Derived Data is located. Click the Delete... button the far right. A dialog will appear, click Delete.
You can also manually delete the Derived Data:
~/Library/Developer/Xcode/DerivedData/{project name + gobly-gook}
This directory contains built products and indexes for the project. It is OK to delete it because it only contains items generated by Xcode. Xcode will regenerate everything next time the project is opened.
I was able to fix it in a much easier way, by simply choosing Product > Clean, then Product > Build from the Xcode menubar.
Deleting the DerivedData folder did not work for me when Archiving.
I had to look at Build Settings - Build Locations - Precompiled Header Cache Path and delete that folder.
For me that was:
/var/folders/_w/t0mj70hd1439tqgxff7_mtt00000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders
I thought I would add a separate answer rather than a comment to Cryptognome's answer, because it is in fact a different solution when the issue comes from running xcodebuild. Like Cryptognome, I had the error come up with the command-line tool xcodebuild. As an alternative to manually going into the /var subfolders, I found that I could set my own cache for the shared PCH, which you can do by setting the environment variable SHARED_PRECOMPS_DIR, e.g as follows
xcodebuild -target Foo -configuration Release SHARED_PRECOMPS_DIR=/tmp/foo/SharedPCH
This way, I never get the error in automatic builds.
Note in the above command, I would also typically set the OBJROOT and SYMROOT env var to build also in /tmp. At the end, I clean things up.
The xcodebuild command line tool sometimes fails with this error. This happened to me when I synched an svn workspace to an earlier build. The xcodebuild tool keeps its precompiled headers in the folder Ants mentioned:
/var/folders/... scrambled eggs .../-Caches-/com.apple.Xcode.503/SharedPrecompiledHeaders/
You have to look in the build command itself to see the actual folder name (-include /var/...), but it may be using several if you're building for different architectures (arm6, arm7, simulator, e.g.) So if you're having this problem with a command line build, just delete everything in /var/.../SharedPrecompiledHeaders.
Remove the contents for the Simulator by iOS Simulator > Reset Content and Settings... and hit Rest. This will remove any existing pre-compiled instances of the headers and resources. This worked for me
Solution:
1)Product->Clean
2)Product->Build
Error Type:
a kind of Build error
One of the causes:
one might have changed the framework file.
This sometimes happens when a change is made to a framework that another framework depends upon. The precompiled header cache gets out of sync, and Xcode is unable to compile the given project.
One of the Scenarios:
one might have chosen Jump To Definition and did some change after selecting a framework control.
I was able to get rid of this error simply by cleaning (command+shift+K) and rebuilding.
I tried above all but no use. Finally I deleted Xcode and re installed again. Now it is working fine..
Xcode->delete->install again
It might help some one...
I had this error on cordova when I ran : cordova run ios
fatal error: file '/Users/.../cordova/platforms/ios/CordovaLib/CordovaLib_Prefix.pch' has been modified since the precompiled header
'/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode/SharedPrecompiledHeaders/CordovaLib_Prefix-bfgesbulnxtdepfwgniffeysypgv/CordovaLib_Prefix.pch.pch' was built
note: please rebuild precompiled header
'/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode/SharedPrecompiledHeaders/CordovaLib_Prefix-bfgesbulnxtdepfwgniffeysypgv/CordovaLib_Prefix.pch.pch'
1 error generated.
** BUILD FAILED **
The following build commands failed:
CompileC build/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Objects-normal/armv7/NSDictionary+Extensions.o Classes/NSDictionary+Extensions.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC build/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Objects-normal/armv7/CDVInvokedUrlCommand.o Classes/CDVInvokedUrlCommand.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
I tried with clean and build but doesn't work, finaly I removed the folder '/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode' and works!
This tip, may be help others
Clean ways are not working for me, eventually I solved this issue by reinstall XCode.