I can not download any image on iOS but works perfectly on Windows and Android.
NetworkRequest { id: networkRequest url: "https://example.example.com/api/currentimage" responsePath:AppFramework.userHomeFolder.filePath("ArcGIS/AppStudio/pipo.jpg") headers.json: {"My-Key": "PIPO"} property url imagePath: AppFramework.resolvedPathUrl(responsePath) onReadyStateChanged: { if ( readyState === NetworkRequest.DONE ) { //console.log("downloaded image") selected.obtainedImagePath = imagePath; busyIndicator.running=false; //console.log(imagePath) selected.mustUpdate = false; } } }
Any idea?
Hi Jorge,
Thank you for your reply.
I have rewritten the example as a complete working application so you should no longer have issues running it.
In my of my code today, I now use the FileInfo object, with this:
I hope you find this example more useful.
Stephen
Make sure the folder exists.
Use FileFolder.makeFolder() to do this.
<SPAN class="keyword token">import</SPAN> QtQuick <SPAN class="number token">2.12</SPAN> <SPAN class="keyword token">import</SPAN> QtQuick<SPAN class="punctuation token">.</SPAN>Controls <SPAN class="number token">2.12</SPAN> <SPAN class="keyword token">import</SPAN> QtQuick<SPAN class="punctuation token">.</SPAN>Layouts <SPAN class="number token">1.12</SPAN> <SPAN class="keyword token">import</SPAN> ArcGIS<SPAN class="punctuation token">.</SPAN>AppFramework <SPAN class="number token">1.0</SPAN> App <SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN> app width<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">400</SPAN> height<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">640</SPAN> property FileInfo target<SPAN class="punctuation token">:</SPAN> FileInfo <SPAN class="punctuation token">{</SPAN> filePath<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"~/ArcGIS/AppStudio/Images/logo.png"</SPAN> <SPAN class="punctuation token">}</SPAN> ColumnLayout <SPAN class="punctuation token">{</SPAN> anchors<SPAN class="punctuation token">.</SPAN>fill<SPAN class="punctuation token">:</SPAN> parent anchors<SPAN class="punctuation token">.</SPAN>margins<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">10</SPAN> Image <SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN> image <SPAN class="punctuation token">}</SPAN> NetworkRequest <SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN> networkRequest url<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"https://appstudio.arcgis.com/images/index/logo-appstudio.png"</SPAN> responsePath<SPAN class="punctuation token">:</SPAN> target<SPAN class="punctuation token">.</SPAN>filePath onReadyStateChanged<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN> readyState <SPAN class="operator token">!==</SPAN> NetworkRequest<SPAN class="punctuation token">.</SPAN>ReadyStateComplete <SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">return</SPAN><SPAN class="punctuation token">;</SPAN> image<SPAN class="punctuation token">.</SPAN>source <SPAN class="operator token">=</SPAN> target<SPAN class="punctuation token">.</SPAN>url <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> Button <SPAN class="punctuation token">{</SPAN> text<SPAN class="punctuation token">:</SPAN> <SPAN class="token function">qsTr</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Download Now"</SPAN><SPAN class="punctuation token">)</SPAN> onClicked<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN> target<SPAN class="punctuation token">.</SPAN>folder<SPAN class="punctuation token">.</SPAN><SPAN class="token function">makeFolder</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> networkRequest<SPAN class="punctuation token">.</SPAN><SPAN class="token function">send</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> Item <SPAN class="punctuation token">{</SPAN> Layout<SPAN class="punctuation token">.</SPAN>fillHeight<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">true</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
The FileFolder don't have a property named filePath... That throws me an error.If i change it to path, then throws this error:
TypeError: Property 'makeFolder' of object function() { [native code] } is not a functionHave you tried that code before posting it?
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.