PDA

View Full Version : Communication between iPhone & MacBook




MikeDimitri
May 2, 2011, 08:21 PM
Hi,

I want to have 1 program running on my phone/simulator that has a slider and a button, and another receiving program on the mac, such as Processing/Supercollider.

When the button is pressed I want a string to be returned in the post window on the mac program, such as 'Hello'. When the slider is moved up/down I want a variable integer (0-100) to be returned on the mac corresponding with the movement of the slider.

I'm assuming a WiFi connection would be essential for the sending of messages between devices - CFSocket or NSStream seem to be the sort of thing I would need but I'm struggling to impliment these in xCode

If anyone could provide any useful tutorials/links/source code this would be much appreciated.

Cheers



chown33
May 3, 2011, 12:38 AM
Sounds like something you could implement with an HTML page, a slider control, and some JavaScript. The MacBook acts as an HTTP server. The page loads from the MacBook to the iPhone using Safari on the phone.

Put the page on the MacBook and turn on Web Sharing in the Sharing panel of System Preferences. Write the JavaScript to send XMLHttpRequests to a PHP or perl script residing on the MacBook. Or just install MAMP on your MacBook and use that.


Since this is effectively your first post (you asked the same question in the wrong forum), please summarize your programming experience and skills, so we know how to frame a more specific answer.