ios - UIDocumentInteractionController doesn't open the app (didEndSendingToApplication: never called) -


i have uidocumentinteractioncontroller instance (that does have strong reference in class, aware of memory issues it) , want send photo file instagram.

i saved file using ig extension (tried igo well) , presenting controller. instagram displayed on list. tap instagram, , nothing happens.

nsurl *imagefile = [nsurl fileurlwithpath:path]; interactioncontroller = [uidocumentinteractioncontroller interactioncontrollerwithurl:imagefile]; interactioncontroller.uti = @"com.instagram.photo"; interactioncontroller.annotation = [nsdictionary dictionarywithobject:@"my caption" forkey:@"instagramcaption"]; interactioncontroller.delegate = self; [interactioncontroller presentopeninmenufromrect:self.view.frame inview:self.view animated:yes]; 

to investigate further, i've set calling class delegate , implemented willbeginsendingtoapplication: , didendsendingtoapplication: methods. interestingly, i've realized willbeginsendingtoapplication: called, didendsendingtoapplication: not. i've tried changing file extensions, changing uti com.instagram.exclusivegram, checking if file url correct etc. none of them seem work. no error, nothing in console or anything. interaction controller closes, app keeps working working before, nothing happens. i've read there can issues on ios 6, app ios 6 app, can't test on ios < 6. thing close problem i've found uidocumentinteractioncontroller, no file extension uti dives low level bits, nor have non-arc code.

what cause of problem?

this can happen if file doesn't exist, if haven't constructed file url correctly. plagued me while.

make sure construct file url this:

nsurl *pagesurl = [nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:@"mygreatpdf.pdf" oftype:nil]]; 

and not this:

nsurl *pagesurl = [nsurl fileurlwithpath:@"mygreatpdf.pdf"]; 

the latter still forms valid url, gets "private" prefix, i.e. file:///private/var/mobile/applications/00000000-0000-0000-0000-000000000000/mygreatapp.app/mygreatpdf.pdf rather file:///var/mobile/applications/00000000-0000-0000-0000-000000000000/mygreatapp.app/mygreatpdf.pdf


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -