# \[PM-162\] IOS and system.perspective.download

**URL:** <https://forum.inductiveautomation.com/t/pm-162-ios-and-system-perspective-download/73671>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [May 12, 2023, 9:20pm UTC](https://forum.inductiveautomation.com/t/pm-162-ios-and-system-perspective-download/73671 "2023-05-12T21:20:15Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![paull](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@paull](https://forum.inductiveautomation.com/u/paull)\
**Post date:** [May 12, 2023, 9:20pm UTC](https://forum.inductiveautomation.com/t/pm-162-ios-and-system-perspective-download/73671/1 "2023-05-12T21:20:15Z")

</div>

Using version 8.1.26

Android devices and browser works. IOS **app** gets a 55kb empty file. This happens with jpg, pdf and text files. IOS device can download file using browser without issue. The download does get the correct filename.

I uses the command  
"system.perspective.download(filename=filename, data=filedata)"

---

<div class="post-metadata">

**Author:** ![Hayden\_Watson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hayden_watson/32/48792_2.png) [@Hayden\_Watson](https://forum.inductiveautomation.com/u/Hayden_Watson)\
**Post date:** [May 15, 2023, 6:17am UTC](https://forum.inductiveautomation.com/t/pm-162-ios-and-system-perspective-download/73671/2 "2023-05-15T06:17:09Z")

</div>

I would report to support, I've come across bugs in the perspective app when downloading in the past. If it works on browser and android fine, it's likely a bug in the iOS version

---

<div class="post-metadata">

**Author:** ![Ken\_Pace](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ken_pace/32/36092_2.png) [@Ken\_Pace](https://forum.inductiveautomation.com/u/Ken_Pace)\
**Post date:** [May 15, 2023, 7:42pm UTC](https://forum.inductiveautomation.com/t/pm-162-ios-and-system-perspective-download/73671/3 "2023-05-15T19:42:42Z")

</div>

Try specifying a Mime type. Here's an example of an onClick action where an image file is in the gateway's data folder.

Edit: I've also filed a ticket to look into making this a bit better.

````auto
	from java.io import File
	from com.inductiveautomation.ignition.gateway.util import MimeTypeUtils
	
	fileName = 'data/image.png'
	
	target = File(fileName)
	
	if (target.exists()):
		data = system.file.readFileAsBytes(fileName)
		fileName = target.getName()
		contentType = MimeTypeUtils.determineMimeType(fileName)
		system.perspective.download(filename = fileName, data = data, contentType = contentType)```
````

---

<div class="post-metadata">

**Author:** ![paull](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@paull](https://forum.inductiveautomation.com/u/paull)\
**Post date:** [June 22, 2023, 4:24pm UTC](https://forum.inductiveautomation.com/t/pm-162-ios-and-system-perspective-download/73671/4 "2023-06-22T16:24:31Z")

</div>

We are using an iPhone with version 16.5 of ios.

We have added the mime type specification, but that does not fix the issue. It still only gives up a 55 byte file. This is the same whether we are exporting a pdf/png/jpeg

These all work with Android phones.

---

<div class="post-metadata">

**Author:** ![paull](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@paull](https://forum.inductiveautomation.com/u/paull)\
**Post date:** [June 22, 2023, 4:40pm UTC](https://forum.inductiveautomation.com/t/pm-162-ios-and-system-perspective-download/73671/5 "2023-06-22T16:40:00Z")

</div>

We just tried the sample project in the application. The download button on the page 'Database Management \> Document Management' does work on the iPhone. So there is something different going on there.

I will download the Perspective Document Management project and see what is different in there.

---

<div class="post-metadata">

**Author:** ![paull](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@paull](https://forum.inductiveautomation.com/u/paull)\
**Post date:** [June 23, 2023, 6:28pm UTC](https://forum.inductiveautomation.com/t/pm-162-ios-and-system-perspective-download/73671/6 "2023-06-23T18:28:37Z")

</div>

Have a little bit more information. It looks the 55 byte file is actually a text string:  
\<h1\>Bad Message 400\</h1\>\<pre\>reason: Bad HostPort\</pre\>

I was trying to troubleshoot the app by viewing the log file but iOS logfile i just a line saying "Unable to create a temporary copy of log file."

---

<div class="post-metadata">

**Author:** ![jcoffman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jcoffman/32/6429_2.png) [@jcoffman](https://forum.inductiveautomation.com/u/jcoffman)\
**Post date:** [June 23, 2023, 6:46pm UTC](https://forum.inductiveautomation.com/t/pm-162-ios-and-system-perspective-download/73671/7 "2023-06-23T18:46:40Z")

</div>

Hey @paull,

What is your gateway's webserver configuration? Do you have force secure redirect and the Public Address Setting `Auto Detect HTTP Address` enabled/disabled?

It looks like its an issue specifically within the gateway but im not 100% sure yet

---

<div class="post-metadata">

**Author:** ![paull](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@paull](https://forum.inductiveautomation.com/u/paull)\
**Post date:** [June 23, 2023, 7:59pm UTC](https://forum.inductiveautomation.com/t/pm-162-ios-and-system-perspective-download/73671/8 "2023-06-23T19:59:42Z")

</div>

I have force secure redirect and Auto Detect HTTP Address enabled. I am using port 443. This is set up on a AWS instance.

It is version 8.26.

---

<div class="post-metadata">

**Author:** ![paull](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@paull](https://forum.inductiveautomation.com/u/paull)\
**Post date:** [July 10, 2023, 3:58pm UTC](https://forum.inductiveautomation.com/t/pm-162-ios-and-system-perspective-download/73671/9 "2023-07-10T15:58:40Z")

</div>

Still working through this issue. Watching the log and everytime the iOS device goes to download, there is a Websocket connection errored out log.

```auto
java.nio.channels.ClosedChannelException: null

at org.eclipse.jetty.websocket.core.internal.WebSocketSessionState.onEof(WebSocketSessionState.java:169)

at org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession.onEof(WebSocketCoreSession.java:253)

at org.eclipse.jetty.websocket.core.internal.WebSocketConnection.fillAndParse(WebSocketConnection.java:482)

at org.eclipse.jetty.websocket.core.internal.WebSocketConnection.onFillable(WebSocketConnection.java:340)

at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)

at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)

at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:558)

at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:379)

at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:146)

at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)

at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)

at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:416)

at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:385)

at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:272)

at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:140)

at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:934)

at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1078)

at java.base/java.lang.Thread.run(Unknown Source)

```

---

<div class="post-metadata">

**Author:** ![jcoffman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jcoffman/32/6429_2.png) [@jcoffman](https://forum.inductiveautomation.com/u/jcoffman)\
**Post date:** [July 11, 2023, 12:09am UTC](https://forum.inductiveautomation.com/t/pm-162-ios-and-system-perspective-download/73671/10 "2023-07-11T00:09:24Z")

</div>

I was able to reproduce this locally and have opened a ticket to address this. Im targeting the next release of the mobile app, no ETA on when that will come out, but ill be working on a basket of tickets for that release after my current work.
