I am trying to use the react-native-notifications library but I am getting a file not found error when I try to import "RNNotifications.h".
I followed the "Linking Libraries Manually" guide on the React Native docs. Play by play, this is what I did:
Step 1:
I opened my project on Xcode, clicked my project's name, opened its "Libraries" folder, then used Finder to add "RNNotifications.xcodeproj" (a file located inside my project's node_modules/react-native-notifications/RNNotifications folder).
Step 2:
Made sure my project was selected, targeted my project's name, then added "libRNNotifications.a" in "Build Phases" under "Link Binary With Libraries".
Step 3: I went under "Build Settings" and added the following path to my "Header Search Paths":
$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications
I did so with the "non-recursive" option because there are no sub-folders inside the RNNotifications folder.
Step 4:
I went inside my project's "AppDelegate.m" and added the following import statement:
#import "RNNotifications.h"
After these four steps, I get a "'RNNotifications.h' file not found" error.
On step 3 when you search for "Header Search Paths" make sure to select the target which is your projects name, you can do this by looking at the left tab, you should see the Project tab with the xcodeproj file under it and another Targets tab. just select your project under the Targets before searching for "Header Search Paths" then add the path there
$(SRCROOT)/../node_modules/react-native-notifications/RNNotifications
This image shows the TARGETS tab which you must select first
As I experiences with these issue.
I have no idea with this package installment.
It's working fine in Android, but not in iOS.
But I have solved it by re-create RNNotifications.h and RNNotifications.m into directory of the main project instead.
Because Main project it's connected with Firebase Library directed.
But if we call from RNNotifications project, you will got error by 'RNNotifications.h' file not found
Here is my structure and edition sample for you, hope it will be help you for some idea:
I had the same problem, so what I did is steps 1, 2, and 3 you have listed above, but before I did step 4, close Xcode and open it which will re index the project or workspace, then type your import statement and it should work, thats what worked for me. If you don't restart xcode or close and open your por
Strangely enough, this seems to have resolved itself. I did nothing differently, nor did I make any modifications--I suppose it is another "wonderful" quirk of Xcode. – user8951490 Jan 25 at 12:17
Use pod install and this will install required library
Related
I get an error when I'm trying to build my App saying that Xcode is unable to find some file (xctest files i believe).
FYI: I recently changed the name of the project from the sidebar in Xcode and it asked me if wanted to update the name of all the other files as well and I said yes so it probably has something to do with that.
Anyone ever experienced that?
It's a very nominal error. To solve the error:
Clean the project
Delete the derived data
Can I safely delete contents of Xcode Derived data folder?
Delete "XCTest.Framework" file from Project Navigator > Targets >
'Project Name' > Build Phases
Try cmd + shift + K to clean
I have a project embed another project, and the xcode GUI build was successful, but in command line xcodebuild failed as such.
fatal error: 'OHAttributedLabel/OHAttributedLabel.h' file not found
#import <OHAttributedLabel/OHAttributedLabel.h>
^
1 error generated.
but I had this in the project HEADER SEARCH PATH (where the h is located)
${PROJECT_DIR}/MyProject/Vendor/OHAttributedLabel/Source
the problem is the header is located in the "OHAttributedLabel/Source" folder, while the import statement is looking for header under OHAttributedLabel folder, I don't want to touch the embedded project directory structure, what can I do in this case?
The best way is to modify the embedded project to publish the header files:
Select the embedded project in xCode
Select the applicable target.
Click on the build phases
Expand "Copy Headers" section and add OHAttributedLabel.h file.
Select your main project
Select the applicable target.
Click on build phases.
Click on Target dependencies.
Make sure that the embedded project is added as a dependency.
Try to run the app
If the above doesn't work double-check the order of the build phases. E.g. make sure that the "Target Dependencies" build phase is before "Compile sources".
I have a file that shows up in "Open Quickly" on Xcode and shows up no place in the project if I do "Reveal in Project Navigator". It does compile correctly into several targets.
If I add the file to the project, the project cannot compile because the file is already included. How can I find this inclusion?
Note: The file does NOT show up in "Open Quickly" on App Code, but I can navigate to it via Command-B.
In AppCode you can use Navigate | File... (Cmd+Shift+O) and check Include non-project files - the file should be shown in the list.
Also, you can open the file in editor, switch navigator to Files mode and use Navigate | Select in... (Alt+F1) | Project View - the file will be shown in its actual location.
After that use Manager Targets action from context menu to see what targets this file belong to.
This bizarre situation happens because you are importing a .m file in one of your #import statements. If you fix this, the project will no longer compile, because the file will not be automatically included.
using Xcode 3.2.5 on 10.6.6 (10J521) and now 10J537.
I have an Xcode project containing 1 Target: "MyApp". It builds and runs successfully.
As well as source and resource files, the Target contains a "Copy Files" build phase which copies "Sparkle.framework" in. The framework is in the same directory as the project.
I want to duplicate this Target. Steps taken:
Did "Clean all Targets".
Right-clicked on the "MyApp" Target within Xcode, and then chose "Duplicate".
Renamed the duplicated target to "MyAppTarget2".
Selected "MyAppTarget2" as the Active Target from the popup menu in the top-left.
Did "Build".
The problem:
error: Sparkle/Sparkle.h: No such file or directory
At the line:
#import <Sparkle/Sparkle.h> // In MyAppDelegate.mm
This is puzzling! Further info:
Each Build step appears to have been replicated in the duplicated Target, including the "Copy Files" phase.
The Sparkle.framework itself exists in the project's folder.
In the "Link Binaries with Library" phase of both "MyApp" and "MyAppTarget2", I am linking to the Sparkle.framework at the above location. A "Get Info" on the linked binary reports that it is a member of both Targets.
If I right-click on the Sparkle.framework file within the "Copy Files" build phase of the duplicated Target, and select "Reveal in Finder", then the correct Sparkle.framework file is shown. The required file exists at Sparkle.framework/Headers/Sparkle.h
If I switch back to the original "MyApp" target, it builds and runs successfully.
Am I doing something obviously wrong here? Thanks.
[EDIT - SOLVED]
I had a look at the Build settings for each supposedly-identical Target.
Under "Framework Search Paths", the first Target had this:
$(inherited) "$(SRCROOT)"
But the duplicated Target had this path:
$(inherited) \"$(SRCROOT)\"
It appears that Xcode incorrectly escaped the path during the duplication process. Ouch.
I know you have already solved this issue yourself, but I thought I'd share my fix for this issue (as it has happened to me several times). I've always been able to get rid of this error by deleting the file in question and just recreating it. I have no idea why this works... but, as is often the case with XCode, there seems to be some Voodoo at work.
Build Phase copy is still broken in 12.5! It does only copy a few of the source targets build phases. What a crap IDE.
I have been trying to build a code that has dependencies with other header files that are not in the project directory. I added the paths to these header files in both HEADER_PATH and USER_PATH. However, I still see error while building. It says that the file is not found. I verified that the file exist in the path added to the header search path in project settings.
How do I make sure that all my header files referenced in the project is included and the paths are being picked by Xcode during compilation?
I tried copying all the files to the project with no luck. This is the first time iam using Xcode, so its kind of frustrating. Iam a linux guy and comfortable with make files. Is there a Make file for xcode which i can modify to include the header file directories.
You might want to check the order of your source files in your target's build phases to ensure that your dependencies are compiled before your source files that reference them.
Select your project in the Project Navigator.
Select your target.
Click on the Build Phases tab.
Click on Compile Sources to expand the section.
Drag the dependencies to the top of the list.
Are you sure you spelled the header file name correctly ? Is the case correct ? Did you use user quotes "" rather than system quotes <> ?
Assuming you've checked all the obvious things such as the above then one other thing to try is to quit Xcode, delete the "build" folder in your project directory, and try again - sometimes the build folder gets in a pickle internally.