iOS Question OpenFile with DocumentInteraction does not work on iPad Air with iOs 11.4.1

sdesan

Member
Licensed User
Longtime User
I made an app with a database of GPS trails. User can choose trails (a .gpx file) from a list and it will be opened with any external GPS app.
Few months ago, due iOs upgrade to ver 11.xx.xx i have to add copy file from DirAssets to DirTemp before invoke OpenFile.
Few days ago a friends of mine showed as on his iPad Air with iOS 11.4.1 the opening file does not works but it works on
iPhone 4 - iOS
iPad 2 - iOS 9.3.5
iPhone 6+ - iOS 11.4.1
iPhone X - iOS 11.4.1
but not on iPad Air 2 with iOS 11.4.1
This is my code
B4X:
'Code module
#If RELEASE
  #CertificateFile: ios_distribution.cer
  #ProvisionFile: sentieri.mobileprovision
#End If
#Region  Project Attributes 
    #ApplicationLabel: I Sentieri del Centro Abruzzo
    #Version: 1.9.0
    #iPhoneOrientations: Portrait 
    #iPadOrientations: Portrait, PortraitUpsideDown 
    #Target: iPhone, iPad
    #MinVersion: 7
#End Region
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public App As Application
    Public NavControl As NavigationController
    Private main1, princi1, genzana1, maiellamain1, parcomaiella1, parconalm1, sirentevelino1, vallesagittario1, mostra1 As Page
    Public di As DocumentInteraction
    Public di_page As String
    ....
End Sub
Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    ....
End Sub

After the user choise i fill a List with data read from a text file with a specific structure to extract more than an information from any line
B4X:
Sub ParcoNALM_Click
    parconalm1.Initialize("parconalm1")
    parconalm1.Title = "I Sentieri del Centro Abruzzo"
    parconalm1.RootPanel.LoadLayout("parconalm") 
    NavControl.ShowPage(parconalm1)
    'leggo le tracce
    If File.Exists(File.DirAssets,"traccepnalm.txt")=True Then
        clv1.Clear
        mylist=File.ReadList(File.DirAssets,"traccepnalm.txt")   
         If mylist.size>1 Then
           For i= 0 To mylist.Size-1
                 line=mylist.Get(i)
                dove=line.IndexOf(";")
                codice=line.SubString2(0,3)
                percorso=line.SubString2(4,dove)
                descri=line.SubString(dove+1)
                di_page=1
                clv1.Add(CreateListItem(percorso, descri, clv1.GetBase.Width, 48dip), 150dip, codice)
           Next
           pre_percorso="pnalm_"
         End If
      Else
        Msgbox("File delle tracce non trovato","Errore")
      End If
End Sub
When user tap a line i will show the gpx file true opening external app
B4X:
ub clv1_ItemClick (Index As Int, Value As Object)
    Dim traccia, nome As String
    nome=Value
    nome=nome.ToLowerCase
    traccia=pre_percorso & nome & ".gpx"
    File.Copy(File.DirAssets, traccia, File.DirTemp, traccia)
    di.Initialize("di", File.DirTemp,traccia)
    Try
        If di_page=1 Then
            di.OpenFile(parconalm1.RootPanel)
        End If
        If di_page=2 Then
            di.OpenFile(vallesagittario1.RootPanel)
        End If
        If di_page=3 Then
            di.OpenFile(genzana1.RootPanel)
        End If
        If di_page=4 Then
            di.OpenFile(sirentevelino1.RootPanel)
        End If
        If di_page=5 Then
            di.OpenFile(parcomaiella1.RootPanel)
        End If
    Catch
        Msgbox("Non posso aprire il file.", "Errore")
    End Try
End Sub
This code works on the above devices but not on iPad Air... (and apple store does not accept any new upgrade of app)
Any suggestions will be apprecciated
Thank you
Sergio
 

sdesan

Member
Licensed User
Longtime User
On all devices, different from iPad Air, when i tap on an element of the list as usal is showed a screen like this

SS-2015-03-18_09.27.24.png


where i can choose the app to use for open files (in my app all files are .gpx files so i use ARA gpx viewer)
On iPad Air the choice of the list is highlighted but dialog box for choosing app isn't showed
Thank you Erel
 
Upvote 0

sdesan

Member
Licensed User
Longtime User
Thank you Erel for the answer but i don't understood your reply :(
Can you write o indicate a little example?
 
Upvote 0

sdesan

Member
Licensed User
Longtime User
Hi Erel in this way it works but i need to set
B4X:
NavControl.NavigationBarVisible = True
and sincerely i prefer to hide navigation bar.
Any other suggestion? :)
 
Upvote 0

sdesan

Member
Licensed User
Longtime User
At the end i used thi solution:

BarButton with the designer.

and

B4X:
NavControl.NavigationBarVisible = True
di.OpenFile(Page1.TopRightButtons.Get(0))
NavControl.NavigationBarVisible = False
I'm waiting for Apple review... (the previous one with iPad Air incompatibility was rejected)

Thank you Erel
 
Upvote 0

mtechteam

Member
Licensed User
Longtime User
The key piece here is room for that list to show. If your entire screen is taken up by a scroll view for example (or RootPanel) and that is the view you choose to send with the Document interaction, it apparently tries to find space outside of that area to display the list. If you choose a small view at the top or bottom of the screen, then it takes the remaining area to display the list and it all works fine.
 
Upvote 0
Top