I have imported the three20 project into my project, and when I upgraded to Xcode 4.2 with iOS 5, a bunch of warnings appeared in the project.
I don't care about them, but they make a lot of noise, and it's easy to miss any real warnings in my project now. Is there a way to disable warnings for those specific libraries?
If your third-party libraries are added as a separate target, you can check Inhibit all warnings for that specific target to turn all warnings off.
If your library is added as plain source files to your current target, you can set -w compiler flag for individual sources to mute all warnings in them. You have to go to Build phases menu of your target configuration and set this flag for each source file in Compile Sources section by double clicking on each file end entering -w flag.
If you are using pods, you can add this to your podfile to prevent warnings logging:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['GCC_WARN_INHIBIT_ALL_WARNINGS'] = "YES"
end
end
end
If the warnings come from the included library or framework header files, you can wrap that include statements like this:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullability-completeness"
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKShareKit/FBSDKShareKit.h>
#pragma clang diagnostic pop
Put your warning flag on the second line above. You can lookup a warning flags here: https://clang.llvm.org/docs/DiagnosticsReference.html
If the warnings are coming from a framework (for me it was Rollbar) that was added with Carthage:
Add a new framework target (i.e. RollbarWrapper) to your project and embed it within your application target
Drag the built framework from Carthage/Build/<platform> into Xcode, adding it to the dummy/wrapper framework you just created (RollbarWrapper)
Make sure that the framework (Rollbar) is added to the dummy/wrapper framework (RollbarWrapper) target's Frameworks and Libraries section and is set to Do Not Embed
Go to the Build Settings for the dummy/wrapper framework (RollbarWrapper) and set "Inhibit All Warnings" to Yes
Next, add the framework (Rollbar) to your application target's Frameworks, Libraries, & Embedded Content section and set to Do Not Embed
Finally, for the application target, do the normal Carthage setup (i.e. create a new Run Script Phase to execute the copy-frameworks script to copy the Rollbar framework)
Related
I'm using the CocoaAsyncSocket library for an application I am writing.
When I compile and run it on my own device there's no problem and Xcode is able to find CocoaAsyncSocket.
However when I'm trying to Archive it won't compile and I get the error message that the module CocoaAsyncSocket can't be found.
I've noticed that it has something to do with the different architectures. When I build for my own device its only building for "arm64" and when I'm archiving its building for arm64,armv7 and armv7s. If I change the build settings for archiving to only build for arm64 I'm able to archive. But of course I want to be able to build it for all architectures.
Picture below displays settings for when its only building for arm64 (in my case);
Build Active Architecture Only: Yes
Has anyone else experienced similar problems with this library or other Cocoapod libraries?
Make sure, the version in the Podfile is good
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
Many developers have embraced the impending 64-bit future but not all third party libraries support this architecture yet, including those installable via CocoaPods.
Despite the lack of universal 64-bit support among 3rd-party pods, CocoaPods still includes the arm64 architecture (via ARCHS_STANDARD_INCLUDING_64_BIT) in its generated targets’ build settings. This can cause problems if your app’s dependencies don’t support arm64, or you only want to build for armv7 and armv7s for other reasons.
You can fix this just add the following to the bottom of your Podfile to revert the ARCHS build setting to ARCHS_STANDARD:
# Remove 64-bit build architecture from Pods targets
post_install do |installer|
installer.project.targets.each do |target|
target.build_configurations.each do |configuration|
target.build_settings(configuration.name)['ARCHS'] = '$(ARCHS_STANDARD_32_BIT)'
end
end
end
Note :
CocoaPods Troubleshooting Guide recommends matching the Debug setting in your Xcode project, rather than changing the Pod's Build Active Architecture Only. As long as they match it seems to fix the problem.
Select the Pods project
Change Build Active Architecture Only from Yes to No.
Or
You can try updating cocoapods in your terminal using command:
gem update cocoapods
If it doesn't work after that, go into your workspace, click on the Pod project, select all Pod targets and set Architectures to (armv7 armv7s arm64).
You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64
How to solve this ?
What is Bitcode?
Bitcode refers to the type of code that is sent to iTunes Connect which allows Apple to use certain calculations to re-optimize apps further. You can learn more about bitcodehere.
Either: "obtain an updated library from the vendor"
or: "disable bitcode for this target."
To disable Bitcode, go to the Build Settings tab of your workspace, scroll down to Build Options, and set Enable Bitcode to No.
the latter can be done through the build settings:
Put config.build_settings['ENABLE_BITCODE'] = 'NO' in the post_install do |installer| section of podfile in your project.
Had the same problem with a Unity problem. Solution. Set "Enable Bitcode" to "yes" in Build Settings -> Build Options on all pod targets ("Pods" project and select all targets at once).
I have incorporate SpatialIite into a Xcode project which uses a header file from Proj.4, just one header. Both are Xcode projects and have static targets.
I'm trying to migrate from git submodule to Cocoapods. Since static targets seems to be difficult to use with Cocoapods, I just want to have the project built in the usual way. I made podspec for Proj.4. After writing podfile for SpatialLite I got the warnings:
[!] The target `SpatialiteIOS [Debug]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The target `SpatialiteIOS [Debug]` overrides the `HEADER_SEARCH_PATHS` build setting defined in `Pods/Pods.xcconfig'.
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The target `SpatialiteIOS [Debug - Release]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The target `SpatialiteIOS [Debug - Release]` overrides the `HEADER_SEARCH_PATHS` build setting defined in `Pods/Pods.xcconfig'.
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
I read this issue but I'm pretty clueless to what the warnings mean and what can I do to fix it.
Additionally problem, when I open the workspace as well as opening SpatiaLite project alone, both are targeted to Mac OSX 64, when it is suppose to be an iOS project. My podfile does say "platform :ios".
This definitely works most of the time:
Go to your target Build Settings -> Other linker flags -> double click . Add $(inherited) to a new line.
If you have problem with "...target overrides the GCC_PREPROCESSOR_DEFINITIONS build setting defined in..." then you must add $(inherited) to your target Build Settings -> Preprocessor Macros
There is a conflict between your build settings and the default build settings that Cocoapods wants. To see the Cocoapods build settings, view the .xcconfig file(s) in Pods/Target Support Files/Pods-${PROJECTNAME}/ in your project. For me this file contains:
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/Commando"
OTHER_LDFLAGS = -ObjC -framework Foundation -framework QuartzCore -framework UIKit
PODS_ROOT = ${SRCROOT}/Pods
If you are happy with the Cocoapods settings, then go to Build Settings for your project, find the appropriate setting and hit the Delete key. This will use the setting from Cocoapods.
On the other hand, if you have a custom setting that you need to use, then add $(inherited) to that setting.
I've seen these 3 errors for pod command in terminal
pod install
[!] The MY_APP [Debug/Release] target overrides the
HEADER_SEARCH_PATHS ...
[!] The MY_APP [Debug/Release] target
overrides the OTHER_LDFLAGS ...
[!] The MY_APP [Debug/Release] target
overrides the GCC_PREPROCESSOR_DEFINITIONS ...
All these 3 errors would be gone by adding $(inherited) to
Header Search Paths
Other Linker Flags
Preprocessor Macros
in Project -> Target -> Build Settings
And now the command would run without giving any errors
pod install
Just had a similar issue when I ran pod install, I saw the following warnings/errors (related to CLANG_CXX_LIBRARY):
The Error/Warning from Cocoapods
[!] The `Project [Debug]` target overrides the `CLANG_CXX_LIBRARY` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Project [Release]` target overrides the `CLANG_CXX_LIBRARY` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
The Fix
Select your Project so you can see the Build Settings.
Select your Target (AppName under Targets)
Find C++ Standard Library (It will probably be in BOLD - This means it's overridden).
Select the Line (So it's highlighted Blue), and press ⌘ + DELETE (Command + Backspace)
The line should not be bolded anymore and if you run pod install the warnings/errors should have disappeared.
Visual Aid
In your project, find Target -> Build Settings -> Other Linker Flags, select Other Linker Flags, press delete(Mac Keyboard)/Backspace(Normal keyboard) to recover the setting. It works for me.
Example:
Before
After
For me the problem was with my targets tests. I already had the $(inherited) flag in my main app target.
I added it to MyAppTests Other Linker flags. After that when I ran pod install the warning message was gone.
If Xcode complains while linking, e.g. Library not found for -lPods, it doesn't detect the implicit dependencies:
Go to Product > Edit Scheme
Click on Build
Add the Pods static library
Clean and build again
The first line of link below saved my day:
To add values to options from your project’s build settings, prepend the value list with $(inherited).
https://github.com/CocoaPods/CocoaPods/wiki/Creating-a-project-that-uses-CocoaPods#faq
Also, do not forget to insert this line at the beginning of your pod file:
platform :iOS, '5.0'
I added $(inherited) but my project was still not compiling. For me problem was flag "Build for active Architecture only", I had to set it to YES.
Xcode Screenshot
Ankish Jain had the answer that worked for me. Here is a screenshot of what to do, as it took me a little bit to find out what exactly to do.
In my case i needed to add $(inherited) to my 'Other Linker Flags' because that is what showed up as Overriding in terminal.
do not forget to insert (or unCommanet) this line at the beginning of your pod file:
platform :iOS, '9.0'
that saves my day
This happens to me every time I add a pod to the podfile.
I constantly try and find the problem but I just go round in circles again and again!
The error messages range, however the way to fix it is the same every time!
Comment out(#) ALL of the pods in the podfile and run pod install in terminal.
Then...
Uncomment out all of the pods in the podfile and run pod install again.
This has worked for me every single time!
When I added the $(inherited) flag to the file in question (in this case it was LIBRARY_SEARCH_PATHS) it led to another error Undefined symbols for architecture arm64: "_swift_getTypeByMangledNameInContextInMetadataState
Changing the following worked and I was able to build:
>LIBRARY_SEARCH_PATHS = (
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
- "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", <--- Change this...
+ "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.2/$(PLATFORM_NAME)\"", <--- to this
"\"$(inherited)\"",
> );
In my application I use 3rd party code that triggers some warnings. I reviewed them and they can be safely ignored.
Now I want to "mark" a file somehow, so Xcode won't show any warnings for the code in that file.
How should I do that?
Select your target and show Build Phases. Then enter the name of the file in the search box, and you should see it listed in the Compile Sources phase. Double-click in the Compiler Flags column for that file and enter -w to turn off all warnings for that file.
Select Project in left navigator and select target go to build phase and Put -w in Build Phase of target file. It will hide all compiler warnings
This works for Xcode 10.2+ and Swift 5
Manual fix:
Add -w -Xanalyzer -analyzer-disable-all-checks to the problematic file from Xcode > Project > Targets > Compile Sources > Double click the file where you want to turn off warnings.
Cocoapods Fix:
If you're trying to suppress warnings from a problematic pod, you can automatically suppress all warnings from the dependency with the inhibit_warnings flag in your podfile:
pod 'Kingfisher', '~> 4.6', :inhibit_warnings => true
I just installed QT 4.6 on snow leopard 10.6.3. I wrote a really simple program. I can generate a xcode project using qmake, but I can't step into QT function. How can I set it up?
By default, qt is built with a debug and a non-debug library. This is my understanding. For example,
% ls /Library/Frameworks/QtCore.framework/
Contents/ Headers# QtCore# QtCore.prl QtCore_debug# QtCore_debug.dSYM/ QtCore_debug.prl Versions/
Also, my default from source build of Qt 4.7 branch also has the *_debug libs.
Setting up for Xcode is cake, you just set up your project and
% qmake -spec macx-xcode
This -spec is the default for the official mac distribution, but if you build your own from source the default is macx-g++ which creates a Makefile project.
This generates a MyProject.xcodeproj that comes preconfigured to link all the necessary Qt frameworks, sets up paths, and has a Release and Debug build target set to the same options as the official SDK's.
This is all assuming you have your qt project file set up, if you need to generate that first from a raw source directory:
% qmake -project
Debugging works "out of the box" for these generated *.xcodeproj files. However, there's one little "hitch". Since Qt is full of custom data types, Xcode doesn't know how to display their "values" in the debugger's summary pane. So you can't see what value a QString has, for example.
There's a method of entering custom macros for display, but I've found these often (always?) don't work for QObjects.
To get that working, I've started a project that uses xcode's debugger c callbacks (also mentioned in the above linked article, though their example doesn't even work o.O). I call it Qt4DataFormatters.
I've just started it and have been adding types as the need arises. It's dirt simple to create one using the existing functions as a template though.
I haven't tried this on Mac, but on Linux you need to take the following process:
First, you need to setup Qt so that it has debugging symbols available to you:
./configure -debug-and-release separate-debug-info # other options
With the debugging symbols available, you should now be able to get valid stack traces.
When building your application with qmake, you need to have the debug (or debug_and_release) flag set in your project file:
CONFIG += debug
Once you've done that, you should only need to tell the debugger where the Qt source is located:
(gdb) dir /path/to/qt/src
After that, list should show you the actual Qt source code. You may need to add additional directories under the src directory for the debugger to pick it all up.