Hi!
I modified the code from this post: https://www.b4x.com/android/forum/threads/open-external-files-with-your-app.50525/
The code above works for files such as Whatsapp attachments (I can see the app and can share ok), but not with files in Photos (the app does not show up in the list of apps that you can share the image with). Am I missing a PListExtra entry perhaps?
I tried adding:
but it didn't make any difference.
I am using an iPhone 7 with iOS 14.01
Thanks for any help I can get!
I modified the code from this post: https://www.b4x.com/android/forum/threads/open-external-files-with-your-app.50525/
B4X:
#Region Project Attributes
#ApplicationLabel: CSV Chooser
#Version: 1.0.0
'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
#iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
#iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
#Target: iPhone, iPad
#ATSEnabled: True
#MinVersion: 8
#PlistExtra:<key>CFBundleDocumentTypes</key>
#PlistExtra:<array><dict><key>CFBundleTypeIconFiles</key><array/>
'#PlistExtra: <key>CFBundleTypeName</key><string>CSV File</string>
#PlistExtra: <key>CFBundleTypeName</key><string>JPEG File</string>
#PlistExtra:<key>LSHandlerRank</key><string>Alternate</string>
#PlistExtra:<key>LSItemContentTypes</key><array>
'#PlistExtra:<string>public.comma-separated-values-text</string>
#PlistExtra:<string>public.jpeg</string>
#PlistExtra:</array></dict></array>
#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 Page1 As Page
Private xui As XUI
End Sub
Private Sub Application_OpenUrl (Url As String, Data As Object) As Boolean
Log("url:" & Url)
If Url.StartsWith("file://") Then
Dim f As String = Url.SubString(7) 'remove the file:// scheme.
Log ("f: " & f)
Try
If File.Exists("",f) Then
Log("file exists!")
'Msgbox(File.ReadString("", f), "")
Else
Log("file does not exist!")
Return True
End If
Catch
Log(LastException.Message)
Msgbox("Error loading file", "")
End Try
End If
Return True
End Sub
The code above works for files such as Whatsapp attachments (I can see the app and can share ok), but not with files in Photos (the app does not show up in the list of apps that you can share the image with). Am I missing a PListExtra entry perhaps?
I tried adding:
B4X:
#PlistExtra:<key>NSPhotoLibraryUsageDescription</key><string>So we can manipulate your photos and videos.</string>
I am using an iPhone 7 with iOS 14.01
Thanks for any help I can get!