iOS Question Application_OpenUrl event raise priority

ilan

Expert
Licensed User
Longtime User
hi

i am using this code to save external files in my app: https://www.b4x.com/android/forum/threads/open-external-files-with-your-app.50525/
my question is when will Application_OpenUrl raised? after Application_Start? after Application_Resize?

i just noticed that the app was started but no data was loaded. that data is loaded in app_resize. i have a boolean in app resize event that checks if it is true. if yes that means that the app was already resized and there is no need to resize some views again. i use the designer for most views but like clv and other views i create them in real time and need to get the width height of the screen to be able to build the items.
 

ilan

Expert
Licensed User
Longtime User
i see this: https://developer.apple.com/documen...iondelegate/1622964-application?language=objc

This method is not called if the delegate returns NO from both the application:willFinishLaunchingWithOptions: and application:didFinishLaunchingWithOptions: methods. (If only one of the two methods is implemented, its return value determines whether this method is called.) If your app implements the applicationDidFinishLaunching: method instead of application:didFinishLaunchingWithOptions:, this method is called to open the specified URL after the app has been initialized.

what is equal to application:willFinishLaunchingWithOptions and application:didFinishLaunchingWithOptions in b4i?
if both exists and return true then openurl will be raised, am i right? or do i understand it wrong?
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
yes i mean the Page1_Resize event.
i have almost finished my app that i am working on. i am using the "open external files in your app" feature from post #1.
everything works fine. today i opened "Files" in ios and wanted to share a file to my app to see that it is working. the app started but the lists in my app was not loaded.
i load it in Page1_Resize. i can move it to a different place but this also tells me that the Page1_Resize event was not raised.
so my question was if the Application_openurl is raised after Page1_Resize or if it can be that the Page1_resize is not raised when i try to import an external file to my app.

should i maybe put a Sleep() command in Application_Openurl?

EDIT: i also load it in Application_Active event. so i check if FirstTime = False then load the db in page_resize else i am loading it in application_active.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. I wouldn't make an assumption about the order of these two events.
2. Application_OpenUrl cannot be a resumable sub as it returns a boolean value.
3. Don't assume that you can access the Url after OpenUrl completed.

Possible solution:
B4X:
Private Sub Application_OpenUrl (Url As String, Data As Object, SourceApplication As String) As Boolean
    'read file
    HandleIncomingFile(FileText)
    Return True
End Sub

Private Sub HandleIncomingFile(s As String)
    Do While SomeList.IsInitialized = False
        Sleep(500)
    Loop
    'continue here
End Sub
 
Upvote 0
Top