Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3675] IOS Assertion failed: (self.url != nil), function -[APSHTTPRequest send], file /Users/kiat/titaniumModules/APSHTTPClient/APSHTTPClient/APSHTTPRequest.m

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionFixed
Resolution Date2016-06-02T20:16:19.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelshttp, xhr
ReporterSuraj Datta
AssigneeShak Hossain
Created2016-05-31T09:41:23.000+0000
Updated2016-06-02T20:16:19.000+0000

Description

Hello, While making XHR Http call I'm getting following error:
Assertion failed: (self.url != nil), function -[APSHTTPRequest send], file /Users/kiat/titaniumModules/APSHTTPClient/APSHTTPClient/APSHTTPRequest.m, line 77.
At this point my app crashes. The API call was suppose to return following JSON value.
{
  "value": [
    {
      "Title": "Preventive Maintenance",
      "URL": "https://api.myjson.com/bins/1gcuw"
    },
    {
      "Title": "PTSA",
      "URL": "https://api.myjson.com/bins/1ii0o"
    },
    {
      "Title": "Principal",
      "URL": "https://api.myjson.com/bins/44t2w"
    },
    {
      "Title": "demo",
      "URL": "https://api.myjson.com/bins/57dyw"
    }
  ]
}
*Code Snippet:*

function initializingAPIcalls() {
	Ti.API.info("Fn called");

var apiUrl = "Cannot Disclose";

var xhr = Ti.Network.createHTTPClient({

		onload : function() {

			response = this.responseText;

			var _response = JSON.parse(response);

			alert(_response);

},

		onerror : function(e) {

			Ti.API.info("Access Token error: " + e.code);

		}
	});

	xhr.open('GET', apiUrl);
	xhr.setRequestHeader("Content-Type", "application/json");
	xhr.setRequestHeader("Accept", "application/json; odata=nometadata");
	xhr.setRequestHeader("Authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSIsImtpZCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSJ9.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAvdGF0YWNsYXNzZWRnZS5zaGFyZXBvaW50LmNvbUA3NWMzZTFkOS1lZGU2LTQxNzAtYTdlYi1mYjk3NWJhOTYyZTYiLCJpc3MiOiIwMDAwMDAwMS0wMDAwLTAwMDAtYzAwMC0wMDAwMDAwMDAwMDBANzVjM2UxZDktZWRlNi00MTcwLWE3ZWItZmI5NzViYTk2MmU2IiwiaWF0IjoxNDY0Njg0NzYxLCJuYmYiOjE0NjQ2ODQ3NjEsImV4cCI6MTQ2NDY4ODY2MSwiYWN0b3IiOiIyN2FjYmJlMC0zZWRhLTQ5MWQtYTk0ZC00ZDVmMjVkODBlYThANzVjM2UxZDktZWRlNi00MTcwLWE3ZWItZmI5NzViYTk2MmU2IiwiaWRlbnRpdHlwcm92aWRlciI6InVybjpmZWRlcmF0aW9uOm1pY3Jvc29mdG9ubGluZSIsIm5hbWVpZCI6IjEwMDNiZmZkOTNiMTQ3ZmMifQ.AY21zJDQrk6lIxfNGfOb6euuTv21dv5CWRVpA6zL3iSLo2eqYxZL4Ul6cBv0Ugdm5gFpJ_PKJJY7C6_4sqFNQYGsBHqRWiqyaA-jeU0TlJvUTtLGKR0gJwY7TrYAnfk8FB_8IH2JhdTwa3SBVn_6MZ4smghfWucj89YVEaKUWhv3O_JjWU75Dd3jvTjYZ5W5SlSASku6GCo2OgS2qXv2RXOkdzcAC7qycyyYnhYgzTi5BbVSbuvRyQ3t_IWu50sKnxO4DhhN2oD9PYTiEaIWp1Bnh9NzR7MMEH2Au-eVrfQPty44s4xiQ21sHN9CBHbZXHDFsNxGduvNKPuf8yAPCA");
	xhr.send();

}
Thanks.

Comments

  1. Sharif AbuDarda 2016-05-31

    Hello, Thanks for creating the ticket. Please provide a full reproducible code and steps to test the issue in our environment. When we are able to reproduce the issue we will provide a fix. Regards, Sharif.
  2. Suraj Datta 2016-06-01

    Hello, The issue is solved guys. Actually my apiURL was having some space in between which was working fine on Postman. Thanks for your response.

JSON Source