Simon
Simon

Reputation: 509

Trying to build SimpleURLConnection for iPhone 4.3

I took SimpleURLConnections as a basis to do some tests. It all worked fine until I tried to run it on my device and set the target build to 4.3. Then I started getting the following message: If you support iOS prior to 5.0, you must re-enable CFStreamCreateBoundPairCompat. Any idea how can I resolve this issue?

Thanks.

Upvotes: 0

Views: 141

Answers (1)

SteveCaine
SteveCaine

Reputation: 512

That error comes from an #error statement in "PostController.m". For iOS the relevant lines are:

#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (__IPHONE_OS_VERSION_MIN_REQUIRED < 50000)
    #error If you support iOS prior to 5.0, you must re-enable CFStreamCreateBoundPairCompat.
#endif

Immediately below that is an 'if/else' block of code, where the first line is 'if (NO)'.

That 'if (NO)' is what's disabling use of CFStreamCreateBoundPairCompat.

You should replace those 'if/else' lines with '#if/#else/#endif' to compile either the first or second block of code depending on which iOS SDK you're targeting:

#if (__IPHONE_OS_VERSION_MIN_REQUIRED < 50000)
    CFStreamCreateBoundPairCompat(
        NULL, 
        ((inputStreamPtr  != nil) ? &readStream : NULL),
        ((outputStreamPtr != nil) ? &writeStream : NULL), 
        (CFIndex) bufferSize
    );
#else
    CFStreamCreateBoundPair(
        NULL, 
        ((inputStreamPtr  != nil) ? &readStream : NULL),
        ((outputStreamPtr != nil) ? &writeStream : NULL), 
        (CFIndex) bufferSize
    );
#endif

Upvotes: 1

Related Questions