You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2020/02/14 03:49:14 UTC

[GitHub] [cordova-plugin-file] crapthings opened a new issue #377: cordova-plugin file works on simulator but not real device?

crapthings opened a new issue #377: cordova-plugin file works on simulator but not real device?
URL: https://github.com/apache/cordova-plugin-file/issues/377
 
 
   i have write an ios share extension, it only works on simulator but not real device.
   
   the framework that i use is meteor 1.9
   cordova-ios version 
   
   {
     "ios": "4.5.5"
   }
   
   cordova-plugin-file is 6.0.2
   
   this is a working demo on simulator
   
   https://streamable.com/u784i
   
   
   but on real device, it tells me NOT_FOUND_ERR
   
   ![image](https://user-images.githubusercontent.com/1147704/74499836-f28b0900-4f1f-11ea-9d44-a95fa9d1343c.png)
   
   ```js
   import axios from 'axios'
   
   const fileReaderSync = file => new Promise(resolve => {
     console.log('fileReaderSync', file)
     const reader = new FileReader()
     reader.onloadend = function () {
       console.log(this.result)
       var blob = new Blob([new Uint8Array(this.result)], { type: file.type })
       resolve(blob)
     }
     reader.readAsArrayBuffer(file)
   })
   
   const resolveLocalFileSystemURLSync = uri => new Promise(resolve => {
     console.dir(uri)
     console.log(uri)
     window.resolveLocalFileSystemURL(uri, function (fileEntry) {
       console.log('resolveLocalFileSystemURL', fileEntry)
       fileEntry.file(resolve)
     }, function (...args) {
       console.log(args, uri)
     })
   })
   
   const uploadFiles = async function (urls) {
     const data = new FormData()
   
     if (urls.length > 0) {
       for (const item of urls) {
         const file = await resolveLocalFileSystemURLSync(item)
         const blob = await fileReaderSync(file)
         data.append('files', blob)
       }
   
       axios({
         method: 'post',
         url: 'http://192.168.50.76:3000/api/upload',
         data,
         headers: {'Content-Type': 'multipart/form-data' }
       })
       .then(function (response) {
         alert(JSON.stringify(response, null, 2));
       })
       .catch(function (response) {
         alert(response);
       })
     }
   }
   
   
   Meteor.isCordova && Meteor.startup(function () {
     cordova.shareextension && cordova.shareextension.onFiles(async function (urls) {
       uploadFiles(urls)
     }, console.log)
   
     cordova.openwith && cordova.openwith.init && cordova.openwith.init(function () {
       cordova.openwith.addHandler(async function (intent) {
         const urls = _.map(intent.items, 'uri')
         uploadFiles(urls)
       })
     }, console.log)
   })
   
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] crapthings edited a comment on issue #377: cordova-plugin file works on simulator but not real device?

Posted by GitBox <gi...@apache.org>.
crapthings edited a comment on issue #377: cordova-plugin file works on simulator but not real device?
URL: https://github.com/apache/cordova-plugin-file/issues/377#issuecomment-586597907
 
 
   hi, i've got problem solved by copy file to  app group container
   
   you can't access /var/mobile/media maybe ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] crapthings commented on issue #377: cordova-plugin file works on simulator but not real device?

Posted by GitBox <gi...@apache.org>.
crapthings commented on issue #377: cordova-plugin file works on simulator but not real device?
URL: https://github.com/apache/cordova-plugin-file/issues/377#issuecomment-586109132
 
 
   this is part of swift code
   
   ```swift
   @objc(ShareExtension) class ShareExtension: CDVPlugin {
       var _command: CDVInvokedUrlCommand?
   
       override func pluginInitialize() {
           super.pluginInitialize()
           NotificationCenter.default.addObserver(
               self,
               selector: #selector(sendUrls),
               name: NSNotification.Name("CDVPluginHandleOpenURLNotification"),
               object: nil
           )
       }
   
       @objc func sendUrls() {
           let userDefaults = UserDefaults(suiteName: "group.com.idibwofa6eg9w4.bk46f44qira.shareextension")!
           let urls = userDefaults.array(forKey: "urls")
           let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: urls)
           result!.keepCallback = true
           self.commandDelegate.send(result, callbackId: _command!.callbackId!)
       }
   
       @objc(onFiles:) func onFiles(command: CDVInvokedUrlCommand) {
           self._command = command
       }
   }
   ```
   
   ```swift
   import MobileCoreServices
   import UIKit
   
   class ShareViewController: UIViewController {
       @IBOutlet weak var textarea: UITextView!
       @IBOutlet weak var done: UIButton!
   
       var userDefaults = UserDefaults(suiteName: "group.com.idibwofa6eg9w4.bk46f44qira.shareextension")!
   
       override func viewDidLoad() {
           super.viewDidLoad()
   
           var urls: [String] = []
   
           guard let extensionItems = extensionContext?.inputItems as? [NSExtensionItem] else {
               return
           }
   
           let group = DispatchGroup()
   
           for extensionItem in extensionItems {
               if let itemProviders = extensionItem.attachments {
                   for itemProvider in itemProviders {
                       group.enter()
                       itemProvider.loadItem(forTypeIdentifier: kUTTypeItem as String, options: nil, completionHandler: { text, error in
                           urls.append("\(text!)")
                           group.leave()
                       })
                   }
               }
           }
   
           group.notify(queue: .main) {
               self.userDefaults.set(urls, forKey: "urls")
               self.userDefaults.synchronize()
               self.textarea.insertText("done \(urls) \n\n")
               self.openURL(URL(string:"openwith://test")!)
               self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
           }
       }
   
       @IBAction func btn(_ sender: UIButton) {
           self.openURL(URL(string:"openwith://test")!)
           self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
       }
   
       @objc func openURL(_ url: URL) -> Bool {
           var responder: UIResponder? = self
           while responder != nil {
               if let application = responder as? UIApplication {
                   return application.perform(#selector(openURL(_:)), with: url) != nil
               }
               responder = responder?.next
           }
           return false
       }
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] crapthings commented on issue #377: cordova-plugin file works on simulator but not real device?

Posted by GitBox <gi...@apache.org>.
crapthings commented on issue #377: cordova-plugin file works on simulator but not real device?
URL: https://github.com/apache/cordova-plugin-file/issues/377#issuecomment-586152417
 
 
   trying to upgrade cordova-ios to 5.1.1, still same issue

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] crapthings edited a comment on issue #377: cordova-plugin file works on simulator but not real device?

Posted by GitBox <gi...@apache.org>.
crapthings edited a comment on issue #377: cordova-plugin file works on simulator but not real device?
URL: https://github.com/apache/cordova-plugin-file/issues/377#issuecomment-586597907
 
 
   hi, i've got problem solved by copy file to  app group container
   
   you can't access /var/mobile/media maybe ?
   
   
   i make this plugin works like android, some work are copied from cordova-plugin-openwith
   https://github.com/crapthings/cordova-plugin-ios-shareextension
   
   android
   https://github.com/j3k0/cordova-plugin-openwith

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] crapthings edited a comment on issue #377: cordova-plugin file works on simulator but not real device?

Posted by GitBox <gi...@apache.org>.
crapthings edited a comment on issue #377: cordova-plugin file works on simulator but not real device?
URL: https://github.com/apache/cordova-plugin-file/issues/377#issuecomment-586597907
 
 
   working meteor demo
   
   https://github.com/crapthings/meteor-cordova-shareextension-demo
   
   hi, i've got problem solved by copy file to  app group container
   
   you can't access /var/mobile/media maybe ?
   
   i make this plugin works like android, some work are copied from cordova-plugin-openwith
   https://github.com/crapthings/cordova-plugin-ios-shareextension
   
   android
   https://github.com/j3k0/cordova-plugin-openwith
   
   this is client code
   
   ```js
   import axios from 'axios'
   
   const fileReaderSync = file => new Promise(resolve => {
     const reader = new FileReader()
     reader.onloadend = function () {
       var blob = new Blob([new Uint8Array(this.result)], { type: file.type })
       resolve(blob)
     }
     reader.readAsArrayBuffer(file)
   })
   
   const resolveLocalFileSystemURLSync = uri => new Promise(resolve => {
     window.resolveLocalFileSystemURL(uri, function (fileEntry) {
       fileEntry.file(resolve)
     })
   })
   
   const uploadFiles = async function (urls) {
     const data = new FormData()
   
     if (urls.length > 0) {
       for (const item of urls) {
         const file = await resolveLocalFileSystemURLSync(item)
         const blob = await fileReaderSync(file)
         data.append('files', blob)
       }
   
       axios({
         method: 'post',
         url: 'http://192.168.50.76:3000/api/upload',
         data,
         headers: {'Content-Type': 'multipart/form-data' }
       })
       .then(function (response) {
         alert(JSON.stringify(response, null, 2));
       })
       .catch(function (response) {
         alert(response);
       })
     }
   }
   
   
   Meteor.isCordova && Meteor.startup(function () {
     cordova.shareextension && cordova.shareextension.onFiles(async function (urls) {
       uploadFiles(urls)
     }, console.log)
   
     cordova.openwith && cordova.openwith.init && cordova.openwith.init(function () {
       cordova.openwith.addHandler(async function (intent) {
         const urls = _.map(intent.items, 'uri')
         uploadFiles(urls)
       })
     }, console.log)
   })
   ```
   
   this is server code
   
   ```js
   import fs from 'fs'
   import express from 'express'
   import cors from 'cors'
   import bodyParser from 'body-parser'
   import multer from 'multer'
   
   const server = express()
   const router = express.Router()
   
   const UPLOAD_PATH = process.env.UPLOAD_PATH || '/Users/monsterstep/dev/cordova-playground/openwith/.uploads'
   
   const storage = multer.diskStorage({
     destination: function (req, file, callback) {
       callback(null, UPLOAD_PATH)
     },
     filename: function (req, file, callback) {
       file._id = Random.id()
       file.createdAt = new Date()
       callback(null, file._id)
     },
   })
   
   const uploader = multer({ storage })
   
   server.use(cors())
   server.use(bodyParser.json())
   server.use(bodyParser.urlencoded({ extended: true }))
   
   server.use('/api', router)
   registerUploadRouter({ router })
   
   WebApp.connectHandlers.use(Meteor.bindEnvironment(server))
   
   function registerUploadRouter ({ router }) {
     router.post('/upload', uploader.array('files'), async function (req, res) {
       res.json(req.files)
     })
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] crapthings edited a comment on issue #377: cordova-plugin file works on simulator but not real device?

Posted by GitBox <gi...@apache.org>.
crapthings edited a comment on issue #377: cordova-plugin file works on simulator but not real device?
URL: https://github.com/apache/cordova-plugin-file/issues/377#issuecomment-586109132
 
 
   @breautek let me see
   
   my real device is running on iphone 6s ios 12.0
   
   i've tested 11 ~ 13 on sim, all works well
   
   
   
   this is part of swift code
   
   ```swift
   @objc(ShareExtension) class ShareExtension: CDVPlugin {
       var _command: CDVInvokedUrlCommand?
   
       override func pluginInitialize() {
           super.pluginInitialize()
           NotificationCenter.default.addObserver(
               self,
               selector: #selector(sendUrls),
               name: NSNotification.Name("CDVPluginHandleOpenURLNotification"),
               object: nil
           )
       }
   
       @objc func sendUrls() {
           let userDefaults = UserDefaults(suiteName: "group.com.idibwofa6eg9w4.bk46f44qira.shareextension")!
           let urls = userDefaults.array(forKey: "urls")
           let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: urls)
           result!.keepCallback = true
           self.commandDelegate.send(result, callbackId: _command!.callbackId!)
       }
   
       @objc(onFiles:) func onFiles(command: CDVInvokedUrlCommand) {
           self._command = command
       }
   }
   ```
   
   ```swift
   import MobileCoreServices
   import UIKit
   
   class ShareViewController: UIViewController {
       @IBOutlet weak var textarea: UITextView!
       @IBOutlet weak var done: UIButton!
   
       var userDefaults = UserDefaults(suiteName: "group.com.idibwofa6eg9w4.bk46f44qira.shareextension")!
   
       override func viewDidLoad() {
           super.viewDidLoad()
   
           var urls: [String] = []
   
           guard let extensionItems = extensionContext?.inputItems as? [NSExtensionItem] else {
               return
           }
   
           let group = DispatchGroup()
   
           for extensionItem in extensionItems {
               if let itemProviders = extensionItem.attachments {
                   for itemProvider in itemProviders {
                       group.enter()
                       itemProvider.loadItem(forTypeIdentifier: kUTTypeItem as String, options: nil, completionHandler: { text, error in
                           urls.append("\(text!)")
                           group.leave()
                       })
                   }
               }
           }
   
           group.notify(queue: .main) {
               self.userDefaults.set(urls, forKey: "urls")
               self.userDefaults.synchronize()
               self.textarea.insertText("done \(urls) \n\n")
               self.openURL(URL(string:"openwith://test")!)
               self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
           }
       }
   
       @IBAction func btn(_ sender: UIButton) {
           self.openURL(URL(string:"openwith://test")!)
           self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
       }
   
       @objc func openURL(_ url: URL) -> Bool {
           var responder: UIResponder? = self
           while responder != nil {
               if let application = responder as? UIApplication {
                   return application.perform(#selector(openURL(_:)), with: url) != nil
               }
               responder = responder?.next
           }
           return false
       }
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] crapthings edited a comment on issue #377: cordova-plugin file works on simulator but not real device?

Posted by GitBox <gi...@apache.org>.
crapthings edited a comment on issue #377: cordova-plugin file works on simulator but not real device?
URL: https://github.com/apache/cordova-plugin-file/issues/377#issuecomment-586109132
 
 
   @breautek let me see
   
   it looks i don't have "private in url"
   
   my real device is running on iphone 6s ios 12.0
   
   i've tested 11 ~ 13 on sim, all works well
   
   
   
   this is part of swift code
   
   ```swift
   @objc(ShareExtension) class ShareExtension: CDVPlugin {
       var _command: CDVInvokedUrlCommand?
   
       override func pluginInitialize() {
           super.pluginInitialize()
           NotificationCenter.default.addObserver(
               self,
               selector: #selector(sendUrls),
               name: NSNotification.Name("CDVPluginHandleOpenURLNotification"),
               object: nil
           )
       }
   
       @objc func sendUrls() {
           let userDefaults = UserDefaults(suiteName: "group.com.idibwofa6eg9w4.bk46f44qira.shareextension")!
           let urls = userDefaults.array(forKey: "urls")
           let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: urls)
           result!.keepCallback = true
           self.commandDelegate.send(result, callbackId: _command!.callbackId!)
       }
   
       @objc(onFiles:) func onFiles(command: CDVInvokedUrlCommand) {
           self._command = command
       }
   }
   ```
   
   ```swift
   import MobileCoreServices
   import UIKit
   
   class ShareViewController: UIViewController {
       @IBOutlet weak var textarea: UITextView!
       @IBOutlet weak var done: UIButton!
   
       var userDefaults = UserDefaults(suiteName: "group.com.idibwofa6eg9w4.bk46f44qira.shareextension")!
   
       override func viewDidLoad() {
           super.viewDidLoad()
   
           var urls: [String] = []
   
           guard let extensionItems = extensionContext?.inputItems as? [NSExtensionItem] else {
               return
           }
   
           let group = DispatchGroup()
   
           for extensionItem in extensionItems {
               if let itemProviders = extensionItem.attachments {
                   for itemProvider in itemProviders {
                       group.enter()
                       itemProvider.loadItem(forTypeIdentifier: kUTTypeItem as String, options: nil, completionHandler: { text, error in
                           urls.append("\(text!)")
                           group.leave()
                       })
                   }
               }
           }
   
           group.notify(queue: .main) {
               self.userDefaults.set(urls, forKey: "urls")
               self.userDefaults.synchronize()
               self.textarea.insertText("done \(urls) \n\n")
               self.openURL(URL(string:"openwith://test")!)
               self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
           }
       }
   
       @IBAction func btn(_ sender: UIButton) {
           self.openURL(URL(string:"openwith://test")!)
           self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
       }
   
       @objc func openURL(_ url: URL) -> Bool {
           var responder: UIResponder? = self
           while responder != nil {
               if let application = responder as? UIApplication {
                   return application.perform(#selector(openURL(_:)), with: url) != nil
               }
               responder = responder?.next
           }
           return false
       }
   }
   ```
   
   and 
   
   console.log(cordova.file)
   
   ![image](https://user-images.githubusercontent.com/1147704/74507254-d6469680-4f36-11ea-9f35-96ff2292834d.png)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] crapthings closed issue #377: cordova-plugin file works on simulator but not real device?

Posted by GitBox <gi...@apache.org>.
crapthings closed issue #377: cordova-plugin file works on simulator but not real device?
URL: https://github.com/apache/cordova-plugin-file/issues/377
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] crapthings edited a comment on issue #377: cordova-plugin file works on simulator but not real device?

Posted by GitBox <gi...@apache.org>.
crapthings edited a comment on issue #377: cordova-plugin file works on simulator but not real device?
URL: https://github.com/apache/cordova-plugin-file/issues/377#issuecomment-586597907
 
 
   hi, i've got problem solved by copy file to  app group container
   
   you can't access /var/mobile/media maybe ?
   
   
   i make this plugin works like android, some work are copied from cordova-plugin-openwith
   https://github.com/crapthings/cordova-plugin-ios-shareextension
   
   android
   https://github.com/j3k0/cordova-plugin-openwith
   
   this is client code
   
   ```js
   import axios from 'axios'
   
   const fileReaderSync = file => new Promise(resolve => {
     const reader = new FileReader()
     reader.onloadend = function () {
       var blob = new Blob([new Uint8Array(this.result)], { type: file.type })
       resolve(blob)
     }
     reader.readAsArrayBuffer(file)
   })
   
   const resolveLocalFileSystemURLSync = uri => new Promise(resolve => {
     window.resolveLocalFileSystemURL(uri, function (fileEntry) {
       fileEntry.file(resolve)
     })
   })
   
   const uploadFiles = async function (urls) {
     const data = new FormData()
   
     if (urls.length > 0) {
       for (const item of urls) {
         const file = await resolveLocalFileSystemURLSync(item)
         const blob = await fileReaderSync(file)
         data.append('files', blob)
       }
   
       axios({
         method: 'post',
         url: 'http://192.168.50.76:3000/api/upload',
         data,
         headers: {'Content-Type': 'multipart/form-data' }
       })
       .then(function (response) {
         alert(JSON.stringify(response, null, 2));
       })
       .catch(function (response) {
         alert(response);
       })
     }
   }
   
   
   Meteor.isCordova && Meteor.startup(function () {
     cordova.shareextension && cordova.shareextension.onFiles(async function (urls) {
       uploadFiles(urls)
     }, console.log)
   
     cordova.openwith && cordova.openwith.init && cordova.openwith.init(function () {
       cordova.openwith.addHandler(async function (intent) {
         const urls = _.map(intent.items, 'uri')
         uploadFiles(urls)
       })
     }, console.log)
   })
   ```
   
   this is server code
   
   ```js
   import fs from 'fs'
   import express from 'express'
   import cors from 'cors'
   import bodyParser from 'body-parser'
   import multer from 'multer'
   
   const server = express()
   const router = express.Router()
   
   const UPLOAD_PATH = process.env.UPLOAD_PATH || '/Users/monsterstep/dev/cordova-playground/openwith/.uploads'
   
   const storage = multer.diskStorage({
     destination: function (req, file, callback) {
       callback(null, UPLOAD_PATH)
     },
     filename: function (req, file, callback) {
       file._id = Random.id()
       file.createdAt = new Date()
       callback(null, file._id)
     },
   })
   
   const uploader = multer({ storage })
   
   server.use(cors())
   server.use(bodyParser.json())
   server.use(bodyParser.urlencoded({ extended: true }))
   
   server.use('/api', router)
   registerUploadRouter({ router })
   
   WebApp.connectHandlers.use(Meteor.bindEnvironment(server))
   
   function registerUploadRouter ({ router }) {
     router.post('/upload', uploader.array('files'), async function (req, res) {
       res.json(req.files)
     })
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] crapthings edited a comment on issue #377: cordova-plugin file works on simulator but not real device?

Posted by GitBox <gi...@apache.org>.
crapthings edited a comment on issue #377: cordova-plugin file works on simulator but not real device?
URL: https://github.com/apache/cordova-plugin-file/issues/377#issuecomment-586109132
 
 
   @breautek let me see
   
   my real device is running on iphone 6s ios 12.0
   
   i've tested 11 ~ 13 on sim, all works well
   
   
   
   this is part of swift code
   
   ```swift
   @objc(ShareExtension) class ShareExtension: CDVPlugin {
       var _command: CDVInvokedUrlCommand?
   
       override func pluginInitialize() {
           super.pluginInitialize()
           NotificationCenter.default.addObserver(
               self,
               selector: #selector(sendUrls),
               name: NSNotification.Name("CDVPluginHandleOpenURLNotification"),
               object: nil
           )
       }
   
       @objc func sendUrls() {
           let userDefaults = UserDefaults(suiteName: "group.com.idibwofa6eg9w4.bk46f44qira.shareextension")!
           let urls = userDefaults.array(forKey: "urls")
           let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: urls)
           result!.keepCallback = true
           self.commandDelegate.send(result, callbackId: _command!.callbackId!)
       }
   
       @objc(onFiles:) func onFiles(command: CDVInvokedUrlCommand) {
           self._command = command
       }
   }
   ```
   
   ```swift
   import MobileCoreServices
   import UIKit
   
   class ShareViewController: UIViewController {
       @IBOutlet weak var textarea: UITextView!
       @IBOutlet weak var done: UIButton!
   
       var userDefaults = UserDefaults(suiteName: "group.com.idibwofa6eg9w4.bk46f44qira.shareextension")!
   
       override func viewDidLoad() {
           super.viewDidLoad()
   
           var urls: [String] = []
   
           guard let extensionItems = extensionContext?.inputItems as? [NSExtensionItem] else {
               return
           }
   
           let group = DispatchGroup()
   
           for extensionItem in extensionItems {
               if let itemProviders = extensionItem.attachments {
                   for itemProvider in itemProviders {
                       group.enter()
                       itemProvider.loadItem(forTypeIdentifier: kUTTypeItem as String, options: nil, completionHandler: { text, error in
                           urls.append("\(text!)")
                           group.leave()
                       })
                   }
               }
           }
   
           group.notify(queue: .main) {
               self.userDefaults.set(urls, forKey: "urls")
               self.userDefaults.synchronize()
               self.textarea.insertText("done \(urls) \n\n")
               self.openURL(URL(string:"openwith://test")!)
               self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
           }
       }
   
       @IBAction func btn(_ sender: UIButton) {
           self.openURL(URL(string:"openwith://test")!)
           self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
       }
   
       @objc func openURL(_ url: URL) -> Bool {
           var responder: UIResponder? = self
           while responder != nil {
               if let application = responder as? UIApplication {
                   return application.perform(#selector(openURL(_:)), with: url) != nil
               }
               responder = responder?.next
           }
           return false
       }
   }
   ```
   
   and 
   
   console.log(cordova.file)
   
   ![image](https://user-images.githubusercontent.com/1147704/74507254-d6469680-4f36-11ea-9f35-96ff2292834d.png)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek commented on issue #377: cordova-plugin file works on simulator but not real device?

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #377: cordova-plugin file works on simulator but not real device?
URL: https://github.com/apache/cordova-plugin-file/issues/377#issuecomment-586102458
 
 
   Can you confirm if this is a duplicate of https://github.com/apache/cordova-plugin-file/issues/346?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] crapthings commented on issue #377: cordova-plugin file works on simulator but not real device?

Posted by GitBox <gi...@apache.org>.
crapthings commented on issue #377: cordova-plugin file works on simulator but not real device?
URL: https://github.com/apache/cordova-plugin-file/issues/377#issuecomment-586597907
 
 
   hi, i've got problem solved by copy file to  app group container

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org