iosios8-share-extension

iOS proving file is accessible for upload from share extension to reactnative


Is there a test way to prove I have access to a file? I'm using

if ([[NSFileManager defaultManager] fileExistsAtPath:[url path]]){

                long long fileSize = [[[NSFileManager defaultManager] attributesOfItemAtPath:url.absoluteString error:nil][NSFileSize] longLongValue];
                NSLog(@"sik: %lld", fileSize); }

I have the if returning positive and I can see the fileSize, but I want to be sure I have access to the file, I was thinking on sending the file to firebase to prove I have access to it, what another way can I prove I have access to the file?

This is inside a share extension, that wants to attach some MS word file, I can see the file exists, and the size, but have some problems accessing the path from react native... so for the moment I just want to prove iOS have access to it... Thanks!


Solution

  • Because of iOS apps being sandboxed by default, if you can see the file, you have access to it.

    What you could do is load the file into a variable and then inspect its contents, if you’re really uncertain.