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

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)"

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

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.

	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)```

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.

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.

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."

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

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.

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

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)

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.

2 Likes