Page 1 of 1

Can recieve iOS push notifications, but how to send?

Posted: Thu Mar 14, 2024 10:35 pm
by Aduro91
Hi all,

I have followed the steps described here to set up and send/recieve push notifications on iOS https://lessons.livecode.com/m/4069/l/1 ... ons-in-ios

I downloaded the example stack and I'm now recieving push notifications on my iPhone app, sending them from my desktop. Yay!

I would now like to send the messages out from the iPhone.

I included all the fields and stack script from the example into my iOS app. I tried sending a push notification to my own iPhone, but its not working. I have the device ID continually checked as I know these can change, so its not that. Everything else is the same as when I send from my desktop other than the folder path to the AuthKey, which I have as:

specialFolderPath("resources") & "/AuthKey......
although I also tried
specialFolderPath("resources")/AuthKey...

I'm not even getting notified of errors via the sort of status field, as I would when running on desktop.

I suspect the issue is this part of the stack script:

Code: Select all

on doSendNotification
   local tScriptFile
   put specialfolderpath("temp") & "/send.sh" into tScriptFile
   put sScript into url ("binfile:/" & tScriptFile)
   get shell ("sh" && tScriptFile)
   put it into fld "output"
end doSendNotification
I'm not fully sure what's happening here, is it creating a file "send.sh" or reading it? I'm just not sure how this works but I'm sure this is where the problem is encountered trying to run on iOS.

Any help would be much appreciated!

Re: Can recieve iOS push notifications, but how to send?

Posted: Fri Mar 15, 2024 10:24 am
by Klaus
"shell" is not supported, there is even no shell at all on iOS!

Re: Can recieve iOS push notifications, but how to send?

Posted: Fri Mar 15, 2024 11:22 pm
by Aduro91
Ah, thanks for letting me know!

Do you think this makes sending a push notification out from an LiveCode iOS app impossible through this general method? Or is there maybe a workaround?

Re: Can recieve iOS push notifications, but how to send?

Posted: Sat Mar 16, 2024 9:58 am
by Klaus
Sorry, I don't have the slightest idea...

Re: Can recieve iOS push notifications, but how to send?

Posted: Sat Mar 16, 2024 10:11 am
by SparkOut
I read through the lesson, its comments and the bug reports that were referenced. It seems like it would be possible to rewrite the process in LC to use tsNet to handle the curl commands, but it's dependant on an update. I am not sure whether or when that's been done.
Sending a push notification is usually done from a server, as mentioned in the lesson
You could write an LC app that makes a post to a server, for which you have control, and have the server take the post from your client app and use that to generate the push notification from server.