My code has implemented both scene:openURLContext and scene:continueUserActivity methods. However when the coming URL is universal link, the second method is being called. If it is not a universal link (e.g. Custom URL scheme), the first method is being called.
My question is what is the difference between these two, and for the first method, I can have access to source application from URLContext. But for the second one only thing I got is a webpageURL. Is this possible for Universal Link to know the source application
I am a totally beginner to iOS. Please correct me if I am wrong. Thanks!
Related
I want to migrate my iOS hybrid app from UIWebView to WKWebView as the former has been deprecated. There are a number of similar questions to this on Stack Overflow that have already been answered but these questions focused on the rather simpler topic of just displaying a web view with out addressing the loading of local files nor the two way interaction required between the Objective C wrapper and the Javascript code for a hybrid app to deliver any functionality.
So far I have established that I need to do the following
Replace the import statement for UIKit with WebKit.
Before creating the wkwebview it is necessary to create a configuration object and set its key allowFileAccessFromFileURLs to TRUE.
After creating the wkwebview, setting its navigationDelegate and its UIDelegate to self.
When loading the url of the html/ccc/js file location, specifying allowingReadAccessToURL to delete the last path component (which I think is the file://)
Set the wkwebview as a sub view of the main view (I think this was not required in UIWebView)
Replacing the existing communications channel from the javascrtipt code to the Objective C code which made use of "shouldStartLoadWithRequest" by creating a script message handler in the wkwebview configuration object mentioned in 2 above and then using this message handler to invoke the processing that used to be done by "shouldStartLoadWithRequest".
Replacing all existing communications channels to the javascript code from the Objective C code which made use of "stringByEvaluatingJavaScriptFromString" with "evaluateJavaScript" which now requires a completion handler which can be set to nil as I am not using any callback values.
Adding a solution to allow the keyboard to be displayed without user selecting an input text field. The best I can see so far is Programmatically focus on a form in a webview (WKWebView). I am somewhat concerned that it appears to need changing every IOS release.
Addressing CORS issues. I understand that WKWebView is much stricter in its implementation of loading remote files from different URLs than UIWebView was, but I am not clear whether there is also a need to whitelist the local files to be loaded as well.
If anyone knows of a check list of things that need to be changed with tips/examples with exact details, or could provide such as an answer that would be superb.
In addition I would like to continue to support pre IOS 11 users by retaining UIWebView for these users as I believe WKWebView had issues in those earlier versions. Does anyone know if this going to cause any additional problems to resolve, and if so how?
Yes
allowFileAccessFromFileURLs is undocumented, so it may or may not work in iOS 13.
Yes
Yes
Yes, and it is required with UIWebViews as well. What might be different is that adding a WKWebView to a storyboard or nib was impossible or buggy, at least until very recent versions of Xcode, which may be why you have that impression.
No, the -webview:shouldStartLoadWithRequest:navigationType: method is a UIWebViewDelegate method. You want the corresponding WKNavigationDelegate method, which is -webView:decidePolicyForNavigationAction:decisionHandler:.
Yes
I can't answer to that, as I've never needed to do it.
See #8
WKWebView has been around since iOS 8, so unless you're targeting iOS 7, Apple still may reject your app once they start rejecting for use of UIWebView. I don't think there's any way to know if that is the case other than submitting the app to find out.
If your javascript makes use of custom schemes that rely on the webview delegate to handle them correctly (i.e., myscheme://some/callback), it can be flaky with Webkit. This is where the script message handler that you alluded to comes in. But you have to update your javascript to use window.webkit.messageHandlers.someCallback.postMessage(someParams) instead of using a custom URL scheme.
Am using xamarin.iOS, I want to open a particular page in my app from an URL which is sending by any e-mail, what is the method to this? I heard about deep linking of applications is this the perfect solution for this scenario? anyone help me to find a perfect solution
Yes, deep linking is the topic that you should be looking into. Refer to
https://developer.xamarin.com/guides/xamarin-forms/platform-features/deep-linking/
You can also read more on different methods here: https://blog.branch.io/universal-links-uri-schemes-app-links-and-deep-links-whats-the-difference/
You can even consider to pay for a service from branch.io for this linking infrastructure.
Use App Links and do the magic on the magic OpenUrl override method
https://developer.xamarin.com/recipes/cross-platform/app-links/app-links-ios/
I am trying to inject a controller into my view(blade.php) but it is being outputted as is
#inject('problems', 'App\Http\Controllers\DonnerController')
this line is being printed on the screen, what's wrong here?
My file name is problems.blade.php
So, i found no solution to the problem. I decided to choose a different route since I wanted to share data to my view without any post request sent from page.
I used
View Composers
a better way to share data to views. I took help from laracasts and this tutorial to implement ViewComposers. I hope it may help any future beginner.
There's a method called didLoadFromCCB that you can implement for any class that has been created in SpriteBuilder. This method is called when Cocos2d loads the class from a CCB file.
What I want to know is: where does this method come from?
Xcode doesn't seem to know it exists, as it doesn't autocomplete.
I'm not having any problems with the method, it's getting called and everything is working perfectly, I'd just like to know where it comes from.
Also, I'd like to know if there is any documentation that lists methods like this that can be called on classes loaded from CCB files. I've had a look around www.spritebuilder.com, but there doesn't seem to be anything of that nature.
CCBReader sends this message. You can search the project in xcode if you need to find its exact origin.
The mistake is that this method wasn't declared in any of the CCBReader headers and isn't in a protocol either, therefore Xcode won't autocomplete it because it's considered a private method. This will be fixed eventually.
There is currently no CCNReader documentation besides the code itself. But didLoadFromCCB is the only method CCBReader will send to nodes.
EDIT: I opened an issue regarding autocomplete of didLoadFromCCB, it's been bothering me too.
I have been using a storyboard, and I have not gotten into the code much, and now it seems that it is time.
I have a form and when the submit button is pressed, do I need to put code to handle that into the .h or the .m file? Also, are there examples of handling a button and making a remote call that I can reference somewhere?
Thanks!!
You might find Apple's Your First iOS App document helpful; it covers connecting buttons to actions in code.
As for making a remote call; there are many ways. I would suggest you look into NSURLConnection and friends as a stating place, but there are many, many libraries to help with this, such as RESTKit.