Post

Replies

Boosts

Views

Activity

Safari notification always return denied
I am trying to implement web notifications for Safari with the following code in the client: script var pushId = "pushId"; var pushNotification = function () { if ('safari' in window && 'pushNotification' in window.safari) { var permissionData = window.safari.pushNotification.permission(pushId); checkRemotePermission(permissionData); } else { alert("Push notifications not supported."); } }; var checkRemotePermission = function (permissionData) { console.log("Chiamo checkRemotePermission"); if (permissionData.permission === 'default') { window.safari.pushNotification.requestPermission( 'socket url' pushId, {}, checkRemotePermission ); console.log("Requested"); } else if (permissionData.permission === 'denied') { console.log("denied"); alert("denied"); } else if (permissionData.permission === 'granted') { console.log("The user said yes, with token: "+ permissionData.deviceToken); alert(permissionData.deviceToken) } }; /script button name="subscribe" value="Activate Notifications" onclick="pushNotification()"Activate Notifications/button And on the server side distributed by node.js: var express = require('express'); var app = express(); var port = process.env.PORT || 3000; console.log('entering on port: '+port) app.listen(port); app.get('/', function(req, res) { console.log('get'); res.sendfile('index.html'); }); app.post('/v2/pushPackages/web.net.inarrivo.pizzomarinellafs', function(req, res) { console.log('register'); res.sendfile('pushPackage.zip'); }); app.post(''socket url'/v2/devices/deviceToken/registation/pushId, function(req, res) { console.log(res) }); app.post(''socket url'/v2/log', function(req, res) { console.log(res) }); Yet I always receive 'denied' and it even seems the back office script is not even touched given no console log is written after the first one. The port on which it is listening is 3000, but I have no idea how to set it on the client side. What is strange is that if I change the url in: window.safari.pushNotification.requestPermission( 'url2' pushId, {}, checkRemotePermission ); to a dummy server I get the same denied answer, like the server were never connected anyway. May someone help to have this thing working?
Topic: Safari & Web SubTopic: General Tags:
0
0
1.3k
Apr ’21
WatchKit App doesn't contain any WatchKit Extensions.
Quite abrupdedly my project stopped executing by reporting error:error: WatchKit App doesn't contain any WatchKit Extensions. Verify that the value of NSExtensionPointIdentifier in your WatchKit Extension's Info.plist is set to com.apple.watchkit.Of course NSExtensionPointIdentifier is correctly set to com.apple.watchkit.What could it be and how to fix it?This is the relevant part of the info.plist file:<key>NSExtension</key> <dict> <key>NSExtensionAttributes</key> <dict> <key>WKAppBundleIdentifier</key> <string>com.information.inArrivo.watchkitapp</string> </dict> <key>NSExtensionPointIdentifier</key> <string>com.apple.watchkit</string> </dict>
10
0
11k
Mar ’21