Post not yet marked as solved
Hi,
Wanted to understand the difference between the delegate methods "openFile" and "openFiles" used to open files with an application in MacOS.
I've tried the following scenarios:
Application Delegate with both openFile and openFiles methods present:
Opening single file - In this case "openFiles" gets triggered with the file path in the filenames parameter array. "openFile" does not get called.
Opening multiple files - In this case, again, "openFiles" gets triggered with the file paths of all the files in the filenames parameter array. "openFile" does not get called again.
Application Delegate with only "openFile" delegate method present:
Opening single file - In this case "openFile" gets triggered with the file path in the filename parameter.
Opening multiple files - In this case "openFile" gets triggered multiple times with the file path in the "filename" parameter. The number of times it gets triggered depends on the number of files that were opened by the application and each time its triggered, it gets the path of the subsequent file.
My observation was that, if "openFiles" was present in the delegate along with "openFile", the latter never gets called. Is this observation correct?
Also, since "openFIle" delegate can still handle multiple file opens at the same time, albeit it is triggered multiple times, is it safe to just use "openFile" in the delegate file(ie. not use openFiles delegate at all)?
Post not yet marked as solved
Hi,
For some of my use cases, I'm extending an interface using a category. I am overriding some of the methods in the base Interface, but want to call the base interface method after I'm done with the workflow inside the category method. Essentially, doing something similar to a "super" call.
While I was looking into how to achieve this, have found something called Method Swizzling( https://nshipster.com/method-swizzling/ , https://newrelic.com/blog/best-practices/right-way-to-swizzle), but this looks too 'hacky'.
Is there a better way to achieve this?
Post not yet marked as solved
When creating a UTI in UIKit for iOS and associating the UTI with the application(using CFBundleDocumentTypes), I've noticed the following behaviour:
If the application is already running, on opening a file associated with the app, only the OpenUrl delegate method gets called
When the app is in the terminated state, when an associated file is opened, it triggers the “WillFinishLaunching”, “DidFinishLaunching” and then the “OpenUrl” delegate method
In both cases we get the file or a list of files at the OpenUrl stage.
This is unlike
the AppKit behavior in Macos, where if files are dropped on the icon and the
application is ‘launched’ – you get the file list BEFORE ‘DidFinishLaunching’,
and files dropped on ‘running application’ is after DidFinishLaunching.
Is this behavior engineered to be different or am I missing something here?
Quoting a line from the UIKit OpenUrl page:
This method is not called if your implementations return 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.)
Does this mean that we should access the URLs sent while opening the file before initializing the application(ie. in didFinishLaunchingWithOptions)
Post not yet marked as solved
Hi,
What would be the recommended UI flow when the user denies a permission that the app requires to function properly? Suppose, the app requires "Location" access and the User presses "Don't Allow" or if the User manually removes the Location Permissions from the Privacy Settings, is there a recommended way to deal with this?
I'm aware of the programmatic way to check for a given permission using the App Tracking Transparency framework.
Post not yet marked as solved
I'm trying to create an independent watchOS application(WatchKit) using Objective-C. In UIKit(iOS) its possible to create an app purely programatically without using any Interface builder files(storyboard or xib). Watchkit has its own programmatic controls like WKInterfaceLabel, but I was not able to use it independently without a storyboard file. Adding to this, there were no entries in the Info.Plist file for the Main storyboard file.
Wanted to understand if it was possible to create a WatchOS application purely using code.