iPhone SDK: Access Localhost through iPad device possible? (while debugging) - iphone

While running/debugging my app with an iPad real device, I want to a establish an internet connection to the localhost:8080 on my computer but it does not work! Why does it work with the simulator but not with a real device?
I want to test my app in a real device but not on a simulator..but thats not possible if I don't have an internet connection..is there a workaround for this in Xcode settings or in the actual code?

The simulator is actually running on localhost, the device isn't. Set the ip to the actual internal network ip of your machine running the web server.

Related

in xcode auto select the real device when connected to laptop

In android studio, if you connect android phone to laptop, phone gets auto selected. Now if you run your project, it runs on auto selected phone.
Is there similar functionality in xcode? Currently if i connect a device to laptop, in xcode i need to always select the connected device manually to run the project on that device.
I don't think XCode will automatically select the connected device. Before connecting the device one of the simulator is our default device. After connecting your physical device you have to change it manually.
It's also mentioned in Developer Documentation, you can check it here : https://developer.apple.com/library/archive/documentation/ToolsLanguages/Conceptual/Xcode_Overview/RunningonaDevice.html

Virtual Mac XCode iPhone debugging - device not connected issue

Please bear with the question (I know there are many repeats but I am sure this is unique) and read this first before you think of downvoting due to duplicity:
This is pertaining to iPhone connected to my local desktop and XCode running on remote VM
The USB gate software is connecting my iPhone to the VM
It's not that XCode fails to detect it altogether.
It's an iPhone 3GS running iOS 5.1. XCode version is 4.6.
Now the issue:
I have the iPhone UDID added to my Apple developer Profile.
I can very well detect the iphone connected into XCode once I do all the necessary sharing for the USB Gate software. I see the yellow light.
It shows yellow light, shows some of the apps installed while some process is running in background. It shows the UDID and usual stuff.
After few moments though, XCode displays the message Device not connected.
I have already added support for armv6 inside my app, so that possibility is ruled out.
What to do?
PS: for the first time it launched iTunes after detection. However then onwards I disabled auto-syncing from iTunes. And now iTunes doesn't detect it even if I launch it explicitly. XCode does detect it, but after some time disconnects it automatically.
I successfully connected to remote VM installing Logmein's Hamachi VPN software on both my host and VM. Using it, XCode could detect my iPhone device once shared via USB Network Gate.

Application Loader (Apple) stuck on "Sending API usage to iTunes Connect"

I am submitting an iOS app to the App Store using Application Loader, however, it never gets past the "Sending API usage to iTunes Connect" stage. There is no error - this stage just doesn't complete.
I have verified that the Mac is connecting to the internet (I can visit websites). Also, the app is tiny (6MB) so this can't conceivably just be a long upload. I've tried leaving this for 20 minutes.
The background to this is that I developed in Flash CS5 on a Windows PC, built it for distribution there, and now on the Mac I am loading the final file into Application Loader to submit it. It verifies/validates the file just fine, but won't go beyond this point.
Any ideas anyone? Perhaps it's a network issue?
I had this problem when behind a firewall.
I got around it by going to Xcode > Contents > Applications > Application Loader > Contents > MacOS > itms > java > lib - Open net.properties with TextEdit and change the line
# https.proxyPort=443
to https.proxyPort=80. This enables the application to use the HTTP port for HTTPS. Worked straight away after this. Hope this helps.
You can solve this with a different approach using your iPhone. Disconnect ethernet internet cable connection (if you have one) and/or switch off wifi connection on your mac. Switch off your iPhone's wifi connection so G3 or G4 is active and turn on personal hotspot. Connect your iPhone with a usb cable with your computer and check in System Preferences -> Network if you're connected to internet via usb with iPhone. Start delivering your app with Application Loader program on your computer via your iPhone's internet connection. And yes you will cross the “Sending API usage to iTunes Connect” barrier and you will be able to upload the package to the iPhone store. At least I was!
If your Mac is has both a WiFi and an Ethernet connection, try turning off WiFi. That solved the problem for me (this time anyway).
I solved only rebooting mac.
I'm still searching for a less drastic solution!
I had my DNS set up to Google DNS. I removed the DNS settings and it worked for me.
Turning off iphone's wifi worked for me
Are you using Xcode Organiser > Upload to App Store or Application Loader?
I found I had the same issue when going though Xcode Organiser so tried it from the Application Loader (found within Xcodes application files) and it worked just fine. If that doesn't work there is a detailed activity log you can check to get a more detailed error.
Other things to try
- check your firewall settings, maybe temporary disable them.
- use an alternative connection, another wifi hotspot if you are on a MacBook, if not do what Oliver said and use your iPhone's cellular data.
I was connected to a VPN, disconnected and problem was solved.

Plug an iOS device into a computer, and then have the computer read its local files?

I'm developing a "two-part" app, where companion apps are installed on an iOS device and an OS X computer. What happens is:
iOS device gets connected to a computer via USB
Once connected, the iOS app writes some stuff to a local file.
Now how can I get the computer to read from that file? Would this require something like Bonjour, even though it is directly connected?
Without going through iTunes and it's File Sharing mechanism or trying to mine backups (also created through syncing in iTunes), you're pretty much out of luck moving data between the iOS device and the computer via the USB connection.
Unfortunately, the only reasonable way to handle this sort of thing is via a wifi network connection between the iOS app and a service running on the Mac. Bonjour is very handy for service location in getting the Mac/iOS device together.

Could not receive a message from the device (iPhone)

I built and run an iPhone application on iPod Touch 2.2.1 device, got some problems and made a fix attempt. Now trying to re-build & run the application gives two (2) error popup notes:
Could not receive a message from the device [OK]
Google couldn't find this! The device itself is working happily, I can even launch and use the app I'm trying to install. iTunes looks like it's still connected... What could be the problem?
Restart the iPhone.
Restart your iPhone device. Also, restart Xcode. This worked for me.
Are you using some "cheap" USB cable? This was the cause in my case.
Just got the same message. I fixed it by connecting my iPhone directly to my Macs USB-Port instead of connecting it to a USB-Hub.
I was having the same issue, and it was due to having old WiFi connection settings. I just connect new WiFi in both iMac and iPhone. I never connect via USB. iMac automatically connects to my iPhone and I can debug directly on my iPhone. Sometimes the connection is loose; in that case, I just go to
-> Windows -> Device and simulators -> select my device -> right click -> connect vai IP address.
Just enter an IP address from my iPhone WiFi. For that, just go to --> WiFi of iPhone -> info (symbol) -> IP address.
I also got this messsage, the problem was too many devices (via USB) connected to my MacBook Pro.
Received this message recently and tried the steps above, specifically different combinations of restarting the iPhone, disconnecting/reconnecting it, and quitting/restarting Xcode.
In the end, I restarted my comp and it works fine now.