user8951490
user8951490

Reputation: 843

Linking React Native Libraries: "RNNotifications.h" not found

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.

Upvotes: 2

Views: 2515

Answers (5)

Tiwari
Tiwari

Reputation: 50

Use pod install and this will install required library

Upvotes: 0

user8951490
user8951490

Reputation: 843

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  

Upvotes: 0

Andrei Calazans
Andrei Calazans

Reputation: 513

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

enter image description here

Upvotes: 9

adam
adam

Reputation: 1

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

Upvotes: 0

Seyha
Seyha

Reputation: 323

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:

enter image description here

Upvotes: 0

Related Questions