NativeScript / push-plugin

Contains the source code for the Push Plugin.
Apache License 2.0
123 stars 45 forks source link

iOS notifications wont work unless open xcode project and enable Push Notifications capability #123

Open bnussey opened 7 years ago

bnussey commented 7 years ago

Hello,

I've added everything to info.plist but to get notifications to work on iOS I still need to open xcode project and manually enable Push Notifications capability.. any ideas as to why I need to do this everytime? Thanks

AntonDobrev commented 7 years ago

@bnussey Indeed, this may be of help to developers. I cannot test right now but I think that if the App Id in your Apple developer account is featuring this capability and you have the respective provisioning profile locally, you can build and deploy the app with this added capability.

On the other hand, if your rely on Xcode to make the build, run or deploy operation, you may need to enable the capability in there. So independent on the worfklow you need to add this capability.

Not sure if the process can be automated, but sounds worth checking.

bnussey commented 7 years ago

Got ya @AntonDobrev so if I update my provisioning profile after enabling notifications then I shouldn't have to do this? I believe my provisioning profile was put in place before doing the notification work, so that could explain it. My research didnt find a way to automate it.. but will have another look and report back if thats the case.

simonox commented 7 years ago

Same on my machine. I can turn on PushNotifications on iOS in Xcode's Capabilities tab and it works. It is not turned on if I prepare the Xcode project with tns prepare ios.

simonox commented 7 years ago

I had to use the nativescript-custom-entitlements plugin to add the entitlement.

DavyDeDurpel commented 7 years ago

Having the same issue. Thanks simonox, for the tip, the custom entitlements plugin solution works like a charm.

diadal commented 5 years ago

this may help someone

setTimeout(function() {
pushPlugin.register(iosSettings, function (data) {
    console.log("Device registered. Access token" + data);

    // Register the interactive settings
        if(iosSettings.interactiveSettings) {
            pushPlugin.registerUserNotificationSettings(function() {
                alert('Successfully registered for interactive push.');
            }, function(err) {
                alert('Error registering for interactive push: ' + JSON.stringify(err));
            });
        }
}, function() { });

},20000)