I have this really strange issue that I can’t seem to figure out. I can preview my app fine with
ionic serve and i can run it on an android device, also no problem. When I run
ionic run ios or
ionic build ios the simulator starts up fine but all of my $http requests TO MY API are returning an error in the $http promise. I can see the error in the simulator debug > system log but there is no stack as the response is not an error, it returns a 200 with the proper response as seen through charles.
I have tested this extensively and cannot figure out if it is some edge case bug or something else. Things I have tested:
- Calling another sample API endpoint, which works fine (http://jsonplaceholder.typicode.com/posts)
- That sample endpoint is http so it’s not an ATS issue
- I have created a new sample project from the sidemenu template, copied and pasted my exact $http request and was able to see the data fine (this is really strange)
- I have inspected the traffic with charles and seen that the request is indeed going out and returning as expected
- I have tested both my local dev api endpoint (over http) and live endpoint (over https), neither work, again only on the ios9 simulator on this particular project
- When I use the jsonplaceholder, results appeared fine in the ios9/iphone6 simulator using the same template code, etc.
- I have almost gone completely line by line and removed nearly every piece of the project to try and track down where this issue could originating with no luck. The idea here was to get it back to as close to the fresh ionic sidemenu project
This really seems like some kind of crazy edge case issue, possibly XCode/iOS Simulator. I’m stumped, it really makes no sense at all.
What I"m trying to find out is if there is anything I can do to try and debug/troubleshoot the ios simulator.
Also, how can I run this directly on my iphone? I have tried to plug the phone in and do
ionic run ios with xcode pointing to my phone but receiving a vague error, possibly about certificates or the app being signed.
Thanks in advance!