1

I am new to iOS development so I am not sure why I would get a compilation error here. Hopefully someone can explain. When I import CoreServices I get the following error when I attempt to compile.

Expected declaration specifiers or '...' before 'CFXMLTreeRef'

Can someone help?

#import <CoreServices/CoreServices.h>

The debugger points to this line in WSMethodInvocation.h:

typedef CALLBACK_API( CFTypeRef , WSMethodInvocationDeserializationProcPtr )(WSMethodInvocationRef invocation, CFXMLTreeRef msgRoot, CFXMLTreeRef deserializeRoot, void *info);

I am not using any function from this file.. I am just importing CoreServices and the error pops up. I am attempting to use:

CFStreamCreatePairWithSocketToCFHost

Ram Saurabh
  • 1,586
  • 8
  • 27
Nick
  • 19,198
  • 51
  • 185
  • 312
  • Post the lines of the code which caused the error themselves! Otherwise, how could we know??? – Yuji Feb 28 '11 at 03:07
  • I updated my post. The import is the cause of the issue. – Nick Feb 28 '11 at 03:13
  • Mmm ... that's strange. Do you import anything before CoreServices? What's the compiler? In my machine, an almost empty line with just `#import ` compiled without problems. – Yuji Feb 28 '11 at 03:19
  • @Yuji did you try this in an iPhone SDK project – Nick Feb 28 '11 at 17:44

1 Answers1

1

Most of the CoreServices are not available on iOS. Instead, use

#import <CFNetwork/CFNetwork.h>

You might want to add the framework to the list of "linked frameworks" in the XCode side panel, too.

Yuji
  • 34,103
  • 3
  • 70
  • 88
  • I thought it had to be a platform issue. These frameworks are all very new to me. Thanks for your help! – Nick Mar 02 '11 at 04:11
  • @Yuji: Please have a look at my related question: http://stackoverflow.com/questions/8116050/why-do-i-get-a-compilation-error-in-coreservices-wsmethodinvocation-h – JOG Nov 14 '11 at 00:37