Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

beachdog

macrumors member
Original poster
Aug 10, 2008
86
0
Uh-oh, I hope I didn't make a boo-boo here...I've built an app that I have been testing on the simulator which uses NSStream and NSHost to do some sockets programming. I had to add in the core services framework to my project in order to build on the simulator, but now when I try to build and deploy to my device it fails with an error "framework not found CoreServices".

Can I not use NSStream etc on the iPhone? Or is there some other way I should set up the project to do so? If I can't use NSStream what is the alternative suggested way to do tcp streams socket (I need something lower level than NSUrl)?
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
NSHost isn't available on the iPhone. NSStream is a part of Foundation so I'm not sure why you should need CoreServices.
 

beachdog

macrumors member
Original poster
Aug 10, 2008
86
0
You're right -- it looks like I was mistaken about this -- I took CoreServices framework out of my project and was able to build and run it on the device as well as the simulator. However, something strange -- when I build I get two warnings for the lines below:

Code:
	NSHost* host = [NSHost hostWithAddress:serverAddress];
	if( host ) {
		[NSStream getStreamsToHost:host 
                     port:server_port 
                     inputStream:&iStream 
                     outputStream:&oStream] ;

The warnings say 'no hostWithAddress method found' and 'no getStreamsToHost' method found. These warnings only display when I build for the device, not when I build for the simulator. Yet the app works fine on the device, and those lines do in fact establish a socket connection to my server. Is this anything to worry about?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.