Closed alssl-ross closed 4 years ago
+1
+1
Same error with: cordova-ios: 6.0.0 cordova-plugin-file-transfer : 1.7.1
By removing lines 107-110 from CDVFileTransfer.m I was able to compile:
NSString* userAgent = [self.commandDelegate userAgent];
if (userAgent) {
[req setValue:userAgent forHTTPHeaderField:@"User-Agent"];
}
Thank you very much, I'll try that. You can no longer publish an app with cordova-ios v5.1.1. ~This issue should be a top priority.~ I have only just read that the plugin is deprecated :D.
is there any alternative to this plugin?
I did go through the process of moving from this plugin to XHR but found that it failed for downloads of large zip files, causing me to revert back to this plugin.
I can compile now thanks to @jansc's comment above. I'm wondering if there is any effect on functionality from removing the userAgent lines. I've not been able to test for myself as yet.
Same error with: cordova-ios: 6.0.0 cordova-plugin-file-transfer : 1.7.1
I cant not compile with @jansc Solution because Ive got: Plugins/cordova-plugin-inappbrowser/CDVWKInAppBrowser.m:27:9: 'Cordova/CDVUserAgentUtil.h' file not found if I delete Lines 107-110
Same error with: cordova-ios: 6.0.0 cordova-plugin-file-transfer : 1.7.1
I cant not compile with @jansc Solution because Ive got: Plugins/cordova-plugin-inappbrowser/CDVWKInAppBrowser.m:27:9: 'Cordova/CDVUserAgentUtil.h' file not found if I delete Lines 107-110
That was fixed on the master branch of cordova-plugin-inappbrowser
:
https://github.com/apache/cordova-plugin-inappbrowser/pull/715
By removing lines 107-110 from CDVFileTransfer.m I was able to compile:
NSString* userAgent = [self.commandDelegate userAgent]; if (userAgent) { [req setValue:userAgent forHTTPHeaderField:@"User-Agent"]; }
It's working for me. Thank you for saving my time
Given the plugin is deprecated, is it worth creating a pull request? I'm not sure if anyone is able to merge the pull request if it was created.
I've forked this repository and made this change in if it's of use to anyone:
Same issue here. I just comment lane 107-110 and my project could build successfully.
Although @alssl-ross did a fork removing the lines, I thought about combining @kolbasa 's solution tip into an own fork so that checking still happening: https://github.com/zoopit/cordova-plugin-file-transfer
Please @alssl-ross create a PR, and hopefully someone with access can merge it in.
I switched to use this Fork
By removing lines 107-110 from CDVFileTransfer.m I was able to compile:
NSString* userAgent = [self.commandDelegate userAgent]; if (userAgent) { [req setValue:userAgent forHTTPHeaderField:@"User-Agent"]; }
After deleting, my network request will not succeed. It seems that userAgent is needed
I've created a thread on the dev mailing list to discuss the matter with this plugin. It would help us PMC members to understand the reasons why you rely on the plugin (too) and especially the reasons why you can't migrate to the proposed XHR/fetch alternative.
@timbru31 I have the same issue as @alssl-ross describes. I have a few lerge files that I need to download from my server and save to the file system - total size of the files is 500Mb. Each file is between 100Mb and 300Mb. I can't split those files into smaller files because they are sqlite database files and splitting them would be a headache. When I download them using angular/ionic http client the file is loaded into memory before I can store it in the file system using the file-plugin. In some cases, specifically on iOS, this causes a "white screen of death". Somewhat related to this issue (see my comment at the end) https://github.com/apache/cordova-plugin-file/issues/364 When all I want to do is download a file and store it somewhere in the application folders there's a problem in iOS and sometimes it fails when not using this plugin. I think the problem is related to how much memory is used by the webview, not sure though...
@HarelM could you please share this insight with the dev mailing list as requested? I'm pretty sure not all active PMC members and committers are watching this issue.
@timbru31 I can't seem to reply to the mailing list but looking at the solution proposed by cordova of using window.requestFileSystem doesn't seem to be a viable solution anymore.
Considering what MDN docs say about it https://developer.mozilla.org/en-US/docs/Web/API/Window/requestFileSystem.
"Even compared to the rest of the File and Directory Entries API, requestFileSystem() is especially non-standard; only Chrome implements it, and all other browser makers have decided that they will not implement it. It has even been removed from the proposed specification. Do not use this method!"
It also doesn't seem to be in TypeScript typings.
I'm pretty sure I already added my comments to that thread, but I don't see it there for some reason. I sent another mail, I hope it will be added...
By removing lines 107-110 from CDVFileTransfer.m I was able to compile:
NSString* userAgent = [self.commandDelegate userAgent]; if (userAgent) { [req setValue:userAgent forHTTPHeaderField:@"User-Agent"]; }
It's working for me. Thank you
By removing lines 107-110 from CDVFileTransfer.m I was able to compile:
NSString* userAgent = [self.commandDelegate userAgent]; if (userAgent) { [req setValue:userAgent forHTTPHeaderField:@"User-Agent"]; }
It's working for me. Thank you for saving my time
its not working.... when i comment this lines, create following issue
Same error with: cordova-ios: 6.0.0 cordova-plugin-file-transfer : 1.7.1
I cant not compile with @jansc Solution because Ive got: Plugins/cordova-plugin-inappbrowser/CDVWKInAppBrowser.m:27:9: 'Cordova/CDVUserAgentUtil.h' file not found if I delete Lines 107-110
facing same issue.
will this be released soon ? i want to know if i should have another approach on this or wait for the release. Thanks
@kolbasa
Thank you very much, I'll try that. You can no longer publish an app with cordova-ios v5.1.1. ~This issue should be a top priority.~ I have only just read that the plugin is deprecated :D.
This is not true. I am using Xcode 12, and my Ionic v1 app is using cordova-ios @5.1.1
, everything compiles just fine and is accepted by Apple. What Apple will no longer accept are apps still using UIWebView
- everyone must convert to WKWebView
Please note, that the deadline for updating UIWebView based apps has been extended by an unknown time: https://developer.apple.com/news/?id=edwud51q
@timbru31 - technically true, but for apps that are already on the store front. New apps are required to use WKWebView. I have two apps, one still on UIWebView that is currently being accepted, and a new app (that is a splintered service from the first app) that had to be submitted with WKWebView. Any chance you could take a look at the bug I submitted last night, related to result.lengthComputable
in success callback?
By removing lines 107-110 from CDVFileTransfer.m I was able to compile:
NSString* userAgent = [self.commandDelegate userAgent]; if (userAgent) { [req setValue:userAgent forHTTPHeaderField:@"User-Agent"]; }
work for me
@vtellez and @imdox Did you find any alternative solution or workaround to compile the code? Or is the transition off of this plugin to https://cordova.apache.org/blog/2017/10/18/from-filetransfer-to-xhr2.html the only solution?
By removing lines 107-110 from CDVFileTransfer.m I was able to compile:
NSString* userAgent = [self.commandDelegate userAgent]; if (userAgent) { [req setValue:userAgent forHTTPHeaderField:@"User-Agent"]; }
work for me
worked for me too but had to update the plugin "cordova-plugin-ionic-webview". So don't forget to update your other plugins.
Can this fix be released please?
Downloading many or large files via XHR is very slow in cordova even if we use chunked downloads (Range-Header). Looks like passing the byte array from javascript to the native backend is the bottleneck. The app hangs while transfering the chunks to the native. So using XHR is not an option for us na d we switched back to this plugin. see https://github.com/apache/cordova-plugin-file/issues/364 When will this fix be released?
too bad someone can't just develop a plugin that lets us use the same methods as cordova-file-transfer, with the XHR method, I believe that would be called a shim, or wrapper plugin, or post a more idiot dev friendly transition article.. my code base relies heavily on something that looks like this:
var ft = new FileTransfer();
ft.upload(imageURI, app.image_upload, win, fail, options);
If I could just load something using the XHR method that would let me create a filetransfer call that would be spectacular
@msudol - why don't you contribute to the project versus criticizing it. I am certain everyone would appreciate the effort.
@msudol - why don't you contribute to the project versus criticizing it. I am certain everyone would appreciate the effort.
I made no criticism, only a request. Your comment is cringy, unwarranted, and provides even less contribution than mine. Where is your PR speaking of contributing.
@msudol - too bad someone can't just develop a plugin that lets us use the same methods as cordova-file-transfer
Doesn't sound like a request....reads like a whiny complaint. Just sayin'. Moving along now...
Please be civil :)
I'll remove any other off-topic comments after this one without a warning. Thanks!
Quick question, on cordova-ios 6.2.0 which by default uses WKWebView, is it only a matter of commenting out those 4 lines of code? Our app uploads video files around 200/300 MB, we are refactoring to WKWebView as per Apple requirements.
NSString* userAgent = [self.commandDelegate userAgent];
if (userAgent) {
[req setValue:userAgent forHTTPHeaderField:@"User-Agent"];
}
@mirko77 I'm using this fork. Works for me. https://github.com/sitewaerts/cordova-plugin-file-transfer. Diff: https://github.com/apache/cordova-plugin-file-transfer/compare/master...sitewaerts:master
I created that fork to merge the fixes from https://github.com/zoopit/cordova-plugin-file-transfer plus the current commits of https://github.com/apache/cordova-plugin-file-transfer
@mirko77 I'm using this fork. Works for me. https://github.com/sitewaerts/cordova-plugin-file-transfer. Diff: master...sitewaerts:master
I created that fork to merge the fixes from https://github.com/zoopit/cordova-plugin-file-transfer plus the current commits of https://github.com/apache/cordova-plugin-file-transfer
Thanks, very useful, I will give it a try
I'm using https://github.com/dpa99c/cordova-plugin-file-transfer for now
I'm using https://github.com/dpa99c/cordova-plugin-file-transfer for now
But thats 12 commits behind apache:master.
still not working on cordova 10
@Noext I do not think this repository ever will, try the linked forks
thankyou, its works with capacitor 3 and last ionic/vue 2021
Just a question (I have loose some comments) but these plugins https://github.com/dpa99c/cordova-plugin-file-transfer https://github.com/sitewaerts/cordova-plugin-file-transfer work for cordova 10?
Excuse my ignorance, but if they work... why to install them the command is always the same? cordova plugin add cordova-plugin-file-transfer
I have to do something else?
To anyone facing this issue this is the only one that worked for me:
(add this to dependencies)
"cordova-plugin-file-transfer": "https://github.com/dpa99c/cordova-plugin-file-transfer/tarball/446b175154491f67bc04a657041a26bc5db92b30",
Excuse my ignorance, but if they work... why to install them the command is always the same? cordova plugin add cordova-plugin-file-transfer
I have to do something else?
cordova plugin add https://github.com/sitewaerts/cordova-plugin-file-transfer
Bug Report
Problem
When building using cordova-ios v6.0.0 an error is thrown saying:
"No known instance method for selector 'userAgent' in CDVFileTransfer.m"
What is expected to happen?
iOS build and run without error.
What does actually happen?
Error occurs as above
Information
The error occurs on line 107 of CDVFileTransfer.m":
NSString* userAgent = [self.commandDelegate userAgent];
Command or Code
Create a Cordova v9 project using cordova-ios 6.0.0 platform and version 1.7.1 of cordova-plugin-file-transfer run: cordova build ios
Environment, Platform, Device
Build error occurs using Cordova v9. cordova-ios 6.0.0 cordova-file-transfer-plugin v1.7.1
Checklist