Can recieve iOS push notifications, but how to send?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Aduro91
Posts: 36
Joined: Sat Jul 22, 2023 8:49 pm

Can recieve iOS push notifications, but how to send?

Post by Aduro91 » Thu Mar 14, 2024 10:35 pm

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!

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Fri Mar 15, 2024 10:24 am

"shell" is not supported, there is even no shell at all on iOS!

Aduro91
Posts: 36
Joined: Sat Jul 22, 2023 8:49 pm

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

Post by Aduro91 » Fri Mar 15, 2024 11:22 pm

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?

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Sat Mar 16, 2024 9:58 am

Sorry, I don't have the slightest idea...

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

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

Post by SparkOut » Sat Mar 16, 2024 10:11 am

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.

Post Reply

Return to “Talking LiveCode”