GithubHelp home page GithubHelp logo

Comments (7)

honkmaster avatar honkmaster commented on July 21, 2024

The problem is: UIDocumentInteractionController relies on local files. You coukd try to create temporary files, by donwloading the files you want to export from the internet. Than open the TTOpenInAppActivity, afterwards you can delete the temporary files.

from ttopeninappactivity.

pepicrft avatar pepicrft commented on July 21, 2024

Thanks @honkmaster ;)

from ttopeninappactivity.

honkmaster avatar honkmaster commented on July 21, 2024

Another notice: You don`t have to use nsdata as activity item. You just have to use a NSURL-Object pointing to a local file.

from ttopeninappactivity.

pepicrft avatar pepicrft commented on July 21, 2024

Thanks @honkmaster I discover later ;), I've to implement then a cache system downloading locally files cleaning them with care :)

from ttopeninappactivity.

pepicrft avatar pepicrft commented on July 21, 2024

Maybe you can help me @honkmaster , I'm trying to do the way you comment but the app crash and I don't know why because I don't get any error in console. That's the code:

 //Generating activities
    TTOpenInAppActivity *openInAppActivity = [[TTOpenInAppActivity alloc] initWithView:self.view andRect:self.view.frame];
    [activities addObject:openInAppActivity];
    TUSafariActivity *safari = [[TUSafariActivity alloc] init];
    [activities addObject:safari];
    ARChromeActivity *chromeActivity = [[ARChromeActivity alloc] init];
    [activities addObject:chromeActivity];


    // Generating and presentin UIActivity
    if([NSData dataWithContentsOfFile:upload.path]){
        //We've the data locally
        UIActivityViewController *activityViewController= [[UIActivityViewController alloc] initWithActivityItems:@[[NSURL URLWithString:upload.path]] applicationActivities:activities];
        //openInAppActivity.superViewController = activityViewController;
        [self.navigationController presentViewController:activityViewController animated:YES completion:NULL];
    }else{
        //We've to download
        [SVProgressHUD show];

        [upload downloadData:^(float progress) {
            if(progress==1.0){
                [SVProgressHUD dismiss];
                UIActivityViewController *activityViewController= [[UIActivityViewController alloc] initWithActivityItems:@[[NSURL URLWithString:upload.path]] applicationActivities:activities];
                //openInAppActivity.superViewController = activityViewController;
                [self.navigationController presentViewController:activityViewController animated:YES completion:NULL];
            }
        } withErrorBlock:^(NSError *error) {
            [SVProgressHUD showErrorWithStatus:NSLocalizedString(@"Error loading attachment", nil)];
        }];
    }

And from console I don't receive any kind of error. It's strange

from ttopeninappactivity.

honkmaster avatar honkmaster commented on July 21, 2024

Maybe you have to use fileURLwithPath (https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/Reference/Reference.html#//apple_ref/occ/clm/NSURL/fileURLWithPath:) ....

from ttopeninappactivity.

pepicrft avatar pepicrft commented on July 21, 2024

Sure @honkmaster , I discovered 😛 thanks for all!

from ttopeninappactivity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.