I have 2 applications, one is iOS app and one is .NET app. I want my iOS app send an message (call a method of .NET app, send some string to .NET ap开发者_运维百科p to save to database). So, how can my iOS app can communicate with .NET app?
If you're looking to communicate with a desktop application on a local network, Bonjour discovery (also called ZeroConf) may be the way to go. Apple makes the Bonjour SDK for Windows freely available, so it appears to be reasonably easy to integrate with your desktop .NET application. Bonjour is already present as part of the networking services in the iPhone SDK.
Using Bonjour, you can transparently detect the presence of an iPhone running your application on the local network from your desktop client (and vice versa), making the process of connecting the two trivial. Once networked, you can send whatever data you want between the two. I show an example of this in action in the video for the networking portion of my advanced iPhone development course on iTunes U.
Create web services for whatever messages you need sent to your .net app. Then look at NSURLConnection
to figure out how you can make those 2 communicate.
I agree with domino (and I voted his response as an answer). .NET web services would be the way to make this work. Web Services were created with the intent of allowing applications on different architecture and technology to communicate together. If you are looking to build an iPhone app that reports usage or saves user data "in the cloud", you would need to have the iPhone app call a .NET web service.
精彩评论