J'affiche un PDF dans un UIScrollView. Pour ce faire, je l'utilise:Comment convertir un chemin NSString en CFURLRef (pour iOS 3.1)?
myDocumentRef = CGPDFDocumentCreateWithURL((CFURLRef)[[NSBundle mainBundle] URLForResource:@"salonMap" withExtension:@"pdf"]);
Maintenant, j'essaie de le faire fonctionner sur un IOS 3.1 (NSBundle URLForResource: withExtension n'existe pas pour 3.1)
Je tournais mon code dans:
NSString *fullPath = [[NSBundle mainBundle] pathForResource:@"salonMap" ofType:@"pdf"];
NSLog(@"%@", fullPath);
CFStringRef fullPathEscaped = CFURLCreateStringByAddingPercentEscapes(NULL,(CFStringRef)fullPath, NULL, NULL,kCFStringEncodingUTF8);
CFURLRef urlRef = CFURLCreateWithString(NULL, fullPathEscaped, NULL);
myDocumentRef = CGPDFDocumentCreateWithURL(urlRef);
Mais elle conduit à une
<Error>: CFURLCreateDataAndPropertiesFromResource: failed with error code -15
Je précise que NSLog enregistre
/var/mobile/Applications/1CF69390-85C7-45DA-8981-A279464E3249/myapp.app/salonMap.pdf"
Comment résoudre ce problème?