iOS Question Notification in production stopped working

kohle

Active Member
Licensed User
Longtime User
Hi,

I have an b4i app in the store which receives push notifications. It worked fine
but today it stopped.
I tried with b4a (DEBUG) with the sandbox link
This works, but in the production it dont work anymore.
I checked the certi. in the developer console and they are active (expires 2017)

Somebody knows what this can be ?

rgs
Jürgen
 

kohle

Active Member
Licensed User
Longtime User
Normally the notification are send to about 84 celphones. I use a modificated pushserver code.
Difference is that it has a ui and get the data from a webserver database.

I made a test for one phone .

The curiosity is, that it worked 2 month.

Only thing what happen was that apple changed the terms of the contract for inapp purchase.
I received a mail and went into the developer console to accept and download the new terms.



Here is my log :

Program started.
send to 1 device(s)
Socket connected
Sending to 3E004BD15703FC8442D02172FFF305BF91093B90E681A4F2D33B140D93B4BF66
Terminated
Feedback Socket connected
Feedback terminated
Message was send


Here is code from the iOSFeedback :

B4X:
Private Sub AStream_Error
   
    CallSubDelayed2(Main,"logjk","Error: " & LastException)

End Sub





Private Sub AStream_Terminated
   
    Dim id As String
   
   
    CallSubDelayed2(Main,"logjk","Feedback terminated")
   
   
    ID_DEL.Clear
   
    For i = 0 To buffer.Size - 1 Step 38
        Dim date() As Byte = SubListToArray(i, 4)
        Dim token() As Byte = SubListToArray(i + 6, 32)
        Log(bc.IntsFromBytes(date)(0))
        Dim HexToken As String = bc.HexFromBytes(token)
        'Log($"Deleting token ${HexToken}"$)
        CallSubDelayed2(Main,"logjk",$"Deleting token ${HexToken}"$)
        'Main.db.ExecNonQuery2("DELETE FROM tokens WHERE token = ?", Array(HexToken))
       
        ID_DEL.Add(HexToken)
       
    Next
   
    If ID_DEL.Size=0 Then
        CallSubDelayed2(Main,"logjk","Message was send")
        'Main.fx.Msgbox(Main.MainForm, "Message was send", "Info")
        'ExitApplication
    End If
   
    If ID_DEL.Size>0 Then
       
        id = ID_DEL.Get(0)
        ID_DEL.RemoveAt(0)
       
        CallSubDelayed2(Main,"logjk","TO DELETE: " & id)

        Dim job2 As HttpJob
         job2.Initialize("job2",Me)
         job2.Download(Main.url_a & "&mess=DEL&id=" & id)   

    End If
   
   
   
   
   
End Sub


Here code from iOSPush :

B4X:
Private Sub astream_NewData (Buffer() As Byte)
    If Buffer.Length >=6 Then
        Log("status=" & Buffer(1))
        Log(Buffer(2))
    Else
       
        CallSubDelayed2(Main,"logjk", "Invalid response")
    End If
End Sub
Private Sub astream_Error
    CallSubDelayed2(Main,"logjk", "error: " & LastException)
    Reconnect
End Sub
Private Sub astream_Terminated
    CallSubDelayed2(Main,"logjk", "Terminated")
    'Reconnect
End Sub
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I don't think that it is related to any changes in Apple. I've just made a test with an existing app and the push notifications work properly.

My guess is that you are trying to send to an invalid id and this causes the connection to break. There were several updated to the push server, specifically related to the feedback service. Compare the code to your code and see whether you are running the most updated code.
 
Upvote 0

kohle

Active Member
Licensed User
Longtime User
I can try this, but its not logical for me , because I send only to one id with one token.

I deinstalled the app from the store and installed with bridge in debug mode. Get the token and
changed link to sandbox and send with java app. Worked fine.
Deinstalled debug app, installed from the istore the production app and get the new token from my database.
Changed sandbox to production link and send with java app . Dont work.

It looks like the certificate for distribution "forget" the "notification enabled".

I dont know it sucks.
 
Upvote 0

kohle

Active Member
Licensed User
Longtime User
I tested with the distrib. certificate on my phone.
Dont work.

If I generate new certi and prov. files in the develop console, how this
effect my app in the app store.
Now they dont receive a notification.
Do I have to upload a new version to the store or will they receive notifications.
(if it works after changing the certi.)
 
Last edited:
Upvote 0

kohle

Active Member
Licensed User
Longtime User
Now it works :

Here what I did :


1) I generated a new aps (apple push service) certificate, downloaded it
2) generated a new push.keystore file

I use this new push.keystore file and it works. Also it works for the old app in the store.

Has the push.keystore file a lifetime ?
Why there is no error when sending a notification?
Why the certificate was not rejected ?

Is this a problem with b4i (keystore) or apple ?
 
Upvote 0
Top