0
votes

I'm trying to integrate the local-notification plugin on my cordova app. It work well on my Android version but when I try to compile it on iOS, I get the following error. If I uninstall the plugin, the app compiles on iOS. I tried to remove and re-add the plugin. I tried to remove and re-add the iOS platform. But I still have the same error.

/Users/julianlecalvez/Documents/MyApp/MyApp/platforms/ios/MyApp/Plugins/de.appplant.cordova.plugin.local-notification/APPLocalNotification.m:28:9: fatal error: module 'UserNotifications' not found

@import UserNotifications;

~~~~~~~^~~~~~~~~~~~~~~~~

1 error generated.

** BUILD FAILED **

The following build commands failed: CompileC build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/APPLocalNotification.o MyApp/Plugins/de.appplant.cordova.plugin.local-notification/APPLocalNotification.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure)

Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/julianlecalvez/Documents/MyApp/MyApp/platforms/ios/cordova/build-debug.xcconfig,-project,MyApp.xcodeproj,ARCHS=i386,-target,MyApp,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/julianlecalvez/Documents/MyApp/MyApp/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/julianlecalvez/Documents/MyApp/MyApp/platforms/ios/build/sharedpch

I checked in the platform folder (platform/ios/MyApp/Plugins/de.appplant.cordova.plugin.local-notification) if the plugin files are copied correctly, and they are! (I have 4 .m files and 4 .h files).

What am I missing ?

Thank you !

1
Which iOS version are you targeting? UserNotifications seems to be the latest iOS 10 notifications API: developer.apple.com/reference/usernotificationsmanelizzard
oh ok. I didn't install the new version. I guess it will be updated soon now, so i'll try. Is there any other library which could work on all version ?Julian Le Calvez
I guess that cordova plugin version will work with all iOS versions, but you should set your Base SDK in the iOS project to iOS 10.0 (I don't know about Cordova... just saying with my native iOS knowledge)manelizzard

1 Answers

0
votes

At a guess, you're using the ios10 branch of the plugin. It doesn't work.

I've just successfully tested notifications on both iOS 9 and iOS 10 using this fork instead.

https://github.com/dpalou/cordova-plugin-local-notifications