globules-io / cordova-plugin-ios-xhr Goto Github PK
View Code? Open in Web Editor NEWCordova iOS 6+ File XHR Plugin
License: MIT License
Cordova iOS 6+ File XHR Plugin
License: MIT License
It's
<preference name="NativeXHRLogging" value="full/none" />
not
<preference name="NativeXHRLogging" value="true/false" />
Not sure if this is a bug or if I'm doing something unexpected.
My environment:
node 10.22
npm 6.14.6
cordova 10.0.0
cordova-ios 6.1.0
ios-deploy 1.11.0
cordova plugin add @globules-io/cordova-plugin-ios-xhr
"cordova-plugin-ios-xhr": {}
rm -fr node_modules
rm -fr plugins
rm -fr platforms
cordova platform add ios
which results in
Discovered plugin "cordova-plugin-ios-xhr". Adding it to the project
Command failed with exit code 1: npm view cordova-plugin-ios-xhr --json
npm ERR! code E404
npm ERR! 404 'cordova-plugin-ios-xhr' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404 (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! 404
npm ERR! 404 'cordova-plugin-ios-xhr@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/sven/.npm/_logs/2020-08-11T21_15_18_934Z-debug.log
{
"error": {
"code": "E404",
"summary": "'cordova-plugin-ios-xhr' is not in the npm registry.\nYou should bug the author to publish it\n(or use the name yourself!)\n\nNote that you can also install from a\ntarball, folder, http url, or git url.",
"detail": "\n 'cordova-plugin-ios-xhr@latest' is not in the npm registry.\nYou should bug the author to publish it (or use the name yourself!)\n\nNote that you can also install from a\ntarball, folder, http url, or git url."
}
}
NOTE:
If I instead install using
cordova plugin add https://github.com/globules-io/cordova-plugin-ios-xhr
I get this line in package.json cordova/plugins
"cordova-plugin-ios-xhr": {}
and also this line in package.json devDependencies
"@globules-io/cordova-plugin-ios-xhr": "git+https://github.com/globules-io/cordova-plugin-ios-xhr.git"
If I manually add "@globules-io/cordova-plugin-ios-xhr": {}
to package.json cordova/plugins everything seems to work as expected!
XCode 12.4
Cordova 6.0
Load image from local resource and Specifies the path to the image is local resource path
Device file path :
"file:///var/mobile/Containers/Data/Application/CE6CC1DD-2883-4FC8-932D-947242BC5020/Library/NoCloud/Driving_posture_V1_20140924_thumb.jpg "
simulator file path:
"file:///Users/mac2/Library/Developer/CoreSimulator/Devices/A78582B1-7A35-4530-B111-E464C058DCD2/data/Containers/Data/Application/ED800D6A-9E5B-42A5-99C7-56CFFB50B884/Library/NoCloud/Driving_posture_V1_20140924_thumb.jpg "
It work in simulator. But it's fail in device.
I got the below error.
Unhandled Promise Rejection: NotSupportedError: The operation is not supported.
Using the window.resolveLocalFileSystemURL() method check the file existence and it gives an Entry object corresponding to it, as long as that file exists within either the TEMPORARY or PERSISTENT filesystems.
File is existing in the path but not accessible.
Its have issue for this:
oracle/cordova-plugin-wkwebview-file-xhr#58
And this is the fix:
https://github.com/oracle/cordova-plugin-wkwebview-file-xhr/pull/37/files
This plugin is not working for me.
I understand this was done as a fix for cordova-plugin-wkwebview-file-xhr which worked ok for my app, until cordova-ios 6
My app loads the html and js files using JS and ajax, but they are not working.
Am I doing something wrong or?
Describe the bug
If you change the initial cordova page to something other than "index.html" the plugin won't load relative path file:// resources correctly. It always tries to resolve relative URL resources from the www/
cordova folder. So, for example, if I have this directory tree for my app
www/
--foo/
----index.html
----script.js
When trying to load relative URL as script.js
the plugin will resolve URL to be file://<all bundle IDs and Application IDs>/www/script.js
and will return a 404 File Not Found error.
Paste your preferences
<!-- skipping not useful information -->
<content src="foo/index.html" />
<preference name="allowFileAccessFromFileURLs" value="true" />
<preference name="allowUniversalAccessFromFileURLs" value="true" />
Expected behavior
Method -(NSURL*)getWebContentResourceURL: (NSString*) uri
from CDVWKWebViewFileXhr.m
should resolve a relative URL script.js
as www/foo/script.js
Additional context
Fixed the problem by changing lines 170 and 171 from mentioned method to
NSURL *baseURL = [[(WKWebView *)self.webView URL] URLByDeletingLastPathComponent];
NSString *wwwuri = uri;
This way, relative resources URL are always resolved from the current WKWebView location.
Hi,
While Install this plugin I got below issue.
cordova plugin add @globules-io/cordova-plugin-ios-xhr
Failed to fetch plugin cordova-plugin-ios-xhr via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code E404
npm ERR! 404 Not Found: cordova-plugin-ios-xhr@latest
npm ERR! A complete log of this run can be found in:
Describe the bug
A clear and concise description of what the bug is.
Same issue as #4 , still not resolved. Not working with both commands present in the docs.
Expected behavior
A clear and concise description of what you expected to happen.
The plugin should be installed.
Thanks for your help.
Response cookies aren't stored anymore
Describe the bug
After uninstalling using cordova plugin rm cordova-plugin-ios-xhr
the following is left in package.json
"devDependencies": {
"@globules-io/cordova-plugin-ios-xhr": "^1.0.5",
Expected behavior
Not leaving anything in package.json after uninstall.
Desktop (please complete the following information):
My environment:
node 10.22
npm 6.14.6
cordova 10.0.0
cordova-ios 6.1.0
ios-deploy 1.11.0
Additional context
Somewhat connected with #4.
Describe the bug
will not affect unsigned certificates
Expected behavior
https addresses are available without signed certificates
Screenshots
2020-10-14 11:00:38.056807+0200 SynMobile[2769:3014509] Task <8761796E-E397-4134-89AF-4995E3B21A4C>.<1> finished with error [-1202] Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “192.168.100.161” which could put your confidential information at risk." UserInfo={NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, NSErrorPeerCertificateChainKey=( "<cert(0x13e80d200) s: fooi: foo>", "<cert(0x13e823800) s: fooi: foo>" ), NSErrorClientCertificateStateKey=0, NSErrorFailingURLKey=https://192.168.100.161:8443/foo/Logon_mobile.action, NSErrorFailingURLStringKey=https://192.168.100.161:8443/foo/Logon_mobile.action, NSUnderlyingError=0x283d5de30 {Error Domain=kCFErrorDomainCFNetwork Code=-1202 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x2801f9c20>, _kCFNetworkCFStreamSSLErrorOriginalValue=-9807, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9807, kCFStreamPropertySSLPeerCertificates=( "<cert(0x13e80d200) s: fooi: foo>", "<cert(0x13e823800) s: fooi: foo>" )}}, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <8761796E-E397-4134-89AF-4995E3B21A4C>.<1>" ), _kCFStreamErrorCodeKey=-9807, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <8761796E-E397-4134-89AF-4995E3B21A4C>.<1>, NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x2801f9c20>, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “192.168.100.161” which could put your confidential information at risk.}
Smartphone (please complete the following information):
Additional context
I'm developing towards a localhost address, this setting will not make it into production but it might be that I have misunderstood what this setting actually does. More detailed explanations in the read.me would be nice
Hello,
When I'm using this plugin with ajax request, the "async=false" parameter does not work, the program continue in next functions before came back in response of the request.
Of course I want to wait for the response of request before executing next functions in my code.
Also when I'm doing request at startup of my application, the error fixed by this plugin is present.
Thank you for your time,
neoCobol
Description
Ajax call (with long server processing time), done via jQuery, has timeout set to value higher than 60 seconds.
Request times out after 60 seconds, unfinished, resulting in ajax error.
Timeout value in ajax settings is not respected in the plugin.
Preferences
<preference name="NativeXHRLogging" value="full" />
<preference name="AllowUntrustedCerts" value="true" />
<preference name="InterceptRemoteRequests" value="all" />
<preference name="allowFileAccessFromFileURLs" value="true" />
<preference name="allowUniversalAccessFromFileURLs" value="true" />
Expected behavior
When using $.ajaxSettings.timeout of e.g. 180000, I expect the network request to only err/timeout after 180 seconds, not earlier.
Device
Example call
$.ajax({
type: "POST",
contentType: "application/json",
url: "url_to_server_endpoint",
dataType: "json",
timeout: 180000,
data: encodeURIComponent("someJSONdata"),
success: function (data) {
// ...
},
error: function(result,status,errorThrown) {
// ...
}
});
As stated in topic, updating to iOS 14 broke loading files via this plugin. On iOS 13.x everything worked.
The plugin is not working for me, i still get "Origin null is not allowed by Access-Control-Allow-Origin" errors on iOS devices.
Can someone post a full guide how to use this plugin please.
package.json correctly contains 1.2.0
plugin.xml still says 1.1.0
Just lost a bit of time trying to work out why even after pulling from Github cordova plugin list
was still reporting version 1.1.0!
Hello,
Using this plugin all requests comes with native iOS User-Agent header.
The header looks similar to this: "appName/3.0.10 CFNetwork/978.0.7 Darwin/18.7.0"
Expected value should be like this: "Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Mobile/15E148 Safari/604.1"
I see that all ajax calls send correct header, but in backend we get that iOS specific one. This is currently a problem to Authenticate with Microsoft Azure where conditional access policy enabled to check the device model. It simply can't recognize the device.
Could that be fixed?
Thank you!
Describe the bug
I get an error on a xhr call to a long url with a length of 761 characters.
Paste your preferences
trying to fetch
but getting a {"readyState":4,"status":400,"statusText":"Bad Request"} error.
network console shows that no xhr call has been made
Expected behavior
xhr response should be: [30000142,30000140,30000119,30000125]
If it is url length then there should be no limit.
Smartphone (please complete the following information):
iOS 13.6
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.