0

I am using Björn Sållarp's excellent Forward Geocoder, to be found at http://blog.sallarp.com/ipad-iphone-forward-geocoding-api-google/

However, I had to get rid of the "autorelease" in the code, since ARC does not support it. Now I have an "Expected Identifier" problem. Does anyone know how to deal with this? Here is original and the affected code:

ORIGINAL:

return [(NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, (CFStringRef)kBSGeocodingLegalCharactersToBeEscaped, kCFStringEncodingUTF8) autorelease];

MY VERSION:

return [(NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, (CFStringRef)kGeocodingLegalCharactersToBeEscaped, kCFStringEncodingUTF8))];

Btw, Xcode suggested to add the "CFBridgingRelease" to the original code.

GoGauchos
  • 588
  • 5
  • 11
George Friday
  • 585
  • 1
  • 6
  • 22
  • 1
    You can just ignore arc on this file. See http://stackoverflow.com/questions/6646052/how-can-i-disable-arc-for-a-single-file-in-a-project – Mike Z Sep 01 '13 at 23:10
  • relevant: http://stackoverflow.com/questions/17227348/nsstring-to-cfstringref-and-cfstringref-to-nsstring-in-arc/17256947#17256947 – Gabriele Petronella Sep 02 '13 at 18:38

3 Answers3

0

loose the outer brackets:

return (NSString*)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, (CFStringRef)kGeocodingLegalCharactersToBeEscaped, kCFStringEncodingUTF8));
Daij-Djan
  • 49,552
  • 17
  • 113
  • 135
0
return (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)string, NULL, (__bridge CFStringRef)kGeocodingLegalCharactersToBeEscaped, kCFStringEncodingUTF8);
Nikolai Ruhe
  • 81,520
  • 17
  • 180
  • 200
0

Go to Build Phases find the classe and in Compiler Flgas input: -fno-objc-arc clear the project and finished

Claudia Mardegan
  • 567
  • 4
  • 14