I want to use react native library RCTLinkingManager which shows up in menu under "Libraries > RCTLinkingManager.xcodeproj".
However when i add it to iOS/AppDelegate.m like so:
#import "RCTLinkingManager.h"
// #implementation ...
Build fails with 'RCTLinkingManager.h' file not found. I tried to clean the product and clean build with no luck.
You have to add $(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS to your "Header Search Paths" in the Build Config of your project. You can find more info on the official React documentation
Kindly make sure that you place the
#import <React/RCTLinkingManager.h>
in the Appdelegate.m file above the
#ifdef FB_SONARKIT_ENABLED
it worked for us.
I had a similar issue only when I've done the archive/release version... that happen because the import was made under the #if DEBUG. So make sure you put the import in the proper place otherwise you can get Use of undeclared identifier 'RCTLinkingManager' error
Anyone who is facing this issue for a react-native archive for ios platform just place
#import <React/RCTLinkingManager.h>"
after the first line
"#import "AppDelegate.h"" in the AppDelegate.m file.
If you are using React Native and the command line, Sébastien's modification proposal is to be made to ios/<yourproject>.xcodeproj/project.pbxproj by adding
"$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS",
to the HEADER_SEARCH_PATHS lists (4 locations)
Oh man. similar to this answer:
Anyone who is facing this issue for a react-native archive for ios
platform just place
#import <React/RCTLinkingManager.h>" after the first line
"#import "AppDelegate.h"" in the AppDelegate.m file.
I had to put it above this line (for react-native#0.70)
#if RCT_NEW_ARCH_ENABLED
Related
I'm trying to add the GameAnalytics SDK to my project (a game),
dragged the framework file onto the project, but when I import it I get an error
saying that the file GameAnalytics/GameAnalytics.h is not found How can I fix that problem?
Import framework to your target:
Build Phases > Embed Frameworks + <Your Framework>
I hope it is works.
Enjoy.
I created a new cli project with --style=sass and then defined some variables in the src/sass/styles.scss (no partials created) so they should be globally defined right? , so when i tried to use them in home.component.scss i got this error https://imgur.com/a/IckJL14
i then added a black border just to make sure normal css works and it did work , the problem is with sass ,
here's the angular.json
"styles": [
"src/sass/styles.scss",
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"./node_modules/malihu-custom-scrollbar-
plugin/jquery.mCustomScrollbar.css",
"./node_modules/animate.css/animate.min.css",
edit: i then created a partial _variables.scss and in the component.scss i wrote #import '~sass/variables'; after importing them in the styles.scss like so #import './variables'; according to the guide from this link : https://scotch.io/tutorials/using-sass-with-the-angular-cli
still not working.
The best approach to achieve this, is creating a variable file and import this file in your scss files.
Like so:
#import "../../variables.scss";
or
#import "~variables.scss";
And in your styles.scss you just put a reference of your variable file!
If it's correct that you used the --style=sass option on project init, then that might be the problem. If you intend to use .scss files (which I would recommend), then you should have used --style=scss.
To fix this now, you can run the command ng set defaults.styleExt scss.
the answer was to simply add the full path to the component.scss like so,
#import "src/sass/~variables.scss"; instead of just #import "~variables.scss";
I have an Xcode 7.2 project that succeeds when building/running against the local device Product|Build. The main project include a reference to InAppSettingsKit project. When I try Product|Archive the build fails. Any help or suggestions will appreciated.
The main project has a bridging header file to InAppSettingsKit project. The problem seems to be that the header file referenced in the bridging header file is not found.
Bridging Header File
#ifndef Screen_Saver_Killer_InAppSettingsKit_Bridging_Header_h
#define Screen_Saver_Killer_InAppSettingsKit_Bridging_Header_h
#endif
#include <UIKit/UIKit.h>
#import "InAppSettingsKit/IASKViewController.h"
#import "InAppSettingsKit/IASKAppSettingsViewController.h"
#import "InAppSettingsKit/IASKSpecifierValuesViewController.h"
#import "InAppSettingsKit/IASKSpecifier.h"
#import "InAppSettingsKit/IASKSettingsReader.h"
#import <iAd/iAd.h>
As requested, here is the search paths of the main project:
(I noticed InAppSettingsKit.xcodeproj is in red; does that mean anything ?)
My problem was with InAppSettingsKit. Their website says: for Archive builds there's a minor annoyance: To make those work, you'll need to add $(OBJROOT)/UninstalledProducts/include to the HEADER_SEARCH_PATHS
This wasn't quite right either.
I think this is a bug in XCode 7.2 + Swift with Obj-C dependencies when archives are built.
I now know way more about xcode than I ever wanted to.
First you need to go through the install logs to find out where things are being built. On my installation $OBJROOT points to:
/Users/jlongo/Library/Developer/Xcode/DerivedData/PROJECTX-bmyyngijghtekdgqqfnabonhpuxo/Build/Intermediates/ArchiveIntermediates/PROJECTX/IntermediateBuildFilesPath
There I found the header files in the path:
.../IntermediateBuildFilesPath/iphoneos/include/InAppSettingsKit/
So my resolution ended up being (non-recursive)
$(OBJROOT)/UninstalledProducts/iphoneos/include
Interestingly, $(OBJROOT) or other recursive paths shorter than this one did not work.
Also I placed this setting in:
Main Project|**Targets**|Build Settings|Header Search Paths
setting it here will not work:
Main Project|**Project**|Build Settings|Header Search Paths
Now that ZXingObjC can be used as a framework I can't figure out for the life of me how to add it to my project. I followed the instructions on the git page https://github.com/TheLevelUp/ZXingObjC, but when I add #import <ZXingObjC/ZXingObjC.h> xcode can't find the file. The example projects that they provide, however, compile fine.
Current answer would be http://cocoapods.org.
Put
pod 'ZXingObjC' into your podfile.
The file below does not exist in library header files.
#import <ZXingObjC/ZXingObjC.h>
Also set library header file path in Search Header Path in Build Settings. and import file as per your requirement.
Why doesn't this code work when compiling an ApplicationTests unit test bundle?
#if TARGET_OS_IPHONE
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#else
#import <Cocoa/Cocoa.h>
#endif
One of my dependencies has this check and compiles just fine in my main application bundles, but it tries to load <Cocoa/Cocoa.h> when compiling my ApplicationTests bundle. It's probably just my lack of understanding of Xcode, but I get nervous when my test bundles don't build. Any suggestions?
You need to add
#include <TargetConditionals.h>
source: https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-8A428/TargetConditionals.h.auto.html
The simplest solution is to move the #import <Foundation/Foundation.h> statement out if the #if condition and replace Cocoa with AppKit like this:
#import <Foundation/Foundation.h>
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#else
#import <AppKit/AppKit.h>
#endif
The Foundation umbrella header imports the NSObjCRuntime header which in turn imports the TargetConditionals header.
I had a similar problem: TARGET_OS_IPHONE isn't defined when building a static library. My solution was to add "-DTARGET_OS_IPHONE" to the "Other C Flags" section of the target build options.
Both work well
#import "TargetConditionals.h"
#import <Foundation/Foundation.h>
<Foundation/Foundation.h>
|
└-#import <Foundation/NSObjCRuntime.h>
|
└- #include <TargetConditionals.h>
|
└- defined TARGET_OS_IPHONE
The solution for me in Xcode 12.5 is to add TARGET_OS_IPHONE or TARGET_OS_IPHONE=1 to GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS in build settings or in an .xcconfig file.
Details:
After updating to Xcode 12.5 beta, now carthage bootstrap will fail when trying to build iRate 1.12.2. I looked in the carthage build log, and the error responsible for the failure is:
error: 'TARGET_OS_IPHONE' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
The problem for me is that iRate is no longer under development, and I'd rather not fork iRate it just to override some broken build setting.
However, there is a nifty workaround trick that I learned from the folks over at Carthage: you can override the build settings of any project using any .xcconfig file by setting an environment variable, XCODE_XCCONFIG_FILE=path/to/my.xcconfig before running xcodebuild. Any settings in that .xcconfig file will now override the settings of whatever project you're building with xcodebuild.
Furthermore you can do this dynamically by a script that you call instead of calling xcodebuild, e.g.:
#!/usr/bin/env bash
# Save this script as 'injectXcodeBuild.sh'
# Run it in place of xcodebuild (all arguments get forwarded through)
# The echo'd commands below will override any settings of the
# projects that get built by xcodebuild through this script.
set -euo pipefail
xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
trap 'rm -f "$xcconfig"' INT TERM HUP EXIT
echo 'GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS=TARGET_OS_IPHONE=1' >> $xcconfig
export XCODE_XCCONFIG_FILE="$xcconfig"
xcodebuild "$#"
Alternatively instead of xcodebuild this script could call carthage if you're needing to override some Carthage dependency's build settings. It might also work for CocoaPods pod command (I'm not sure).
Note: in Swift one must use:
#if os(iOS)