iOS -Attach file from Cloud Storage


#1

I am developing chat application. I have alreadz implemented attach Photos from iOS devices and capture photo.
Now I am trying to add PDF or WORD and EXCEL file from iOS devices.
iOS only support and allow to attach these files only from Cloud storage installed on Mobile device.

Can anybody have an idea that How can I implement this in Nativescript application. ??

I would to implement same as implemented in whatsapp… add files from iCloud and other cloud storage and share.

Please let me know. If you have some idea on this or already implemented…

How can I create this UIDocumentPickerViewController using Nativescript. ??


#2

@jen.looper : How can we implement UIDocumentMenuViewController to show list of Cloud platform installed on Device. Select one of the cloud platform and select document to upload.


#3

I’m not at all sure, sorry! Anyone else have an idea?


#4

@jen.looper : I have found out something to implement this but I do not have how these thing I can implement using marshalling.

Does any one have Idea that How Objective C code to {N} and I can use it in Ng2 Project… ?

 /** Create the array of UTI Type that you want to support
     * Pass the array of UTI Type that application wants to support. Add more UTI
        Type if you want to support more other than listed

     */
     NSArray *types = @[(NSString*)kUTTypeImage,(NSString*)kUTTypeSpreadsheet,(NSString*)kUTTypePresentation,(NSString*)kUTTypeDatabase,(NSString*)kUTTypeFolder,(NSString*)kUTTypeZipArchive,(NSString*)kUTTypeVideo];
    //Create a object of document menu view and set the mode to Import
    UIDocumentMenuViewController *objMenuView = [[UIDocumentMenuViewController alloc]initWithDocumentTypes:types inMode:UIDocumentPickerModeImport];
  
    //Create Custom option to display
    [objMenuView addOptionWithTitle:@"My Custom option" image:nil order:UIDocumentMenuOrderFirst handler:^{
        //Call when user select the option
       
    }];
    //Set the delegate
    objMenuView.delegate = self;
    //present the document menu view
    [self presentViewController:objMenuView animated:YES completion:nil];


When user select any option other than custom we have to display the document view controller to select the file.To get the notification we have to implement UIDocumentMenuDelegate.

- (void)documentMenu:(UIDocumentMenuViewController *)documentMenu didPickDocumentPicker:(UIDocumentPickerViewController *)documentPicker {
    documentPicker.delegate = self;
    [self presentViewController:documentPicker animated:YES completion:nil];
}

#5

here’s a blogpost that may help http://fluentreports.com/blog/?p=167