iOS Question DELETE METHOD

Pooya1

Active Member
Licensed User
I use below code for basic4android
B4X:
Job.PostString("http://example.com/check.php","id=1")
        Job.GetRequest.InitializeDELETE2(http://example.com/check.php","id=1".GetBytes("UTF8"))

And below code for basic4ios
B4X:
Job.PostString("http://example.com/check.php","id=1")
Job.GetRequest.InitializeDelete("http://example.com/check.php?id=1")

Android is working but iOS not working
Actually send null to script
Why?
 

OliverA

Expert
Licensed User
Longtime User
InitializeDelete2 <> InitializeDelete.

InitializeDelete2 sends data
"id=1".GetBytes("UTF8")
to the link you provided

InitializeDelete on the other hand sends no data and the data encoded in the URL seems to be ignored (since that is not how the DELETE command works: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE ). So you are using two different methods for sending a DELETE command and you are getting two different results.
 
Upvote 0

Pooya1

Active Member
Licensed User
InitializeDelete2 <> InitializeDelete.

InitializeDelete2 sends data to the link you provided

InitializeDelete on the other hand sends no data and the data encoded in the URL seems to be ignored (since that is not how the DELETE command works: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE ). So you are using two different methods for sending a DELETE command and you are getting two different results.
Thank you
But i am beginner in programming
Do you can give me sample?
I'm sorry for my request
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
FYI: Never used these methods before. But looking at your initial post the method is InitializeDelete2, not Delete2. If it does not exist in B4i, you may need to post another question and see if someone knows how to add it.
 
Upvote 0

Pooya1

Active Member
Licensed User
The products names are B4A and B4i.

The correct way to create a DELETE request is with HttpJob.Delete or Delete2.

DELETE requests usually do not have a request body. What are you communicating with?

I am communicating with web service that use restful protocol for it
I can use in B4a but in B4i not send any data
It is important point in my app
Thanks
 
Upvote 0

Pooya1

Active Member
Licensed User
Try this:
B4X:
Dim j As HttpJob
j.Initialize("", Me)
j.PostBytes("link here ", "aaa".GetBytes("utf8"))
Dim no As NativeObject = j.GetRequest
no.GetField("object").RunMethod("setHTTPMethod:", Array("DELETE"))
Yes of course ,I'm going to try :cool:
 
Upvote 0

Pooya1

Active Member
Licensed User
Try this:
B4X:
Dim j As HttpJob
j.Initialize("", Me)
j.PostBytes("link here ", "aaa".GetBytes("utf8"))
Dim no As NativeObject = j.GetRequest
no.GetField("object").RunMethod("setHTTPMethod:", Array("DELETE"))
Yes it is working :):):):)
Erel can i use this code for PUT method or other?
 
Upvote 0
Top