0
0
iOS Swiftmobile~20 mins

Deep linking in iOS Swift - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Deep Linking Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
ui_behavior
intermediate
2:00remaining
What happens when the app receives a deep link URL?
Consider an iOS app configured to handle deep links. When the app receives a URL like myapp://profile/123, what is the expected behavior?
AThe app opens and navigates to the profile screen showing user with ID 123.
BThe app crashes because the URL scheme is not recognized.
CThe app opens but stays on the home screen without navigation.
DThe app opens a web browser to load the URL externally.
Attempts:
2 left
💡 Hint
Deep links allow apps to open specific screens directly.
📝 Syntax
intermediate
2:00remaining
Which Swift method handles incoming deep link URLs in the app delegate?
In iOS Swift apps, which method is called when the app is asked to open a URL via deep linking?
Afunc applicationWillTerminate(_ application: UIApplication)
Bfunc applicationDidBecomeActive(_ application: UIApplication)
Cfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
Dfunc application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool
Attempts:
2 left
💡 Hint
This method receives the URL and options when opening a URL.
lifecycle
advanced
2:00remaining
What happens if the app is not running and a deep link is opened?
If the user taps a deep link URL and the app is not running at all, what is the correct sequence of events in iOS?
AThe app launches and immediately crashes due to missing URL handling.
BThe app launches, but the URL is ignored because the app was not running.
CThe app launches, <code>didFinishLaunchingWithOptions</code> is called with the URL info, then <code>application(_:open:options:)</code> is called.
DThe app launches and only <code>applicationDidBecomeActive</code> is called without URL info.
Attempts:
2 left
💡 Hint
The launch options contain the URL when the app starts from a deep link.
🔧 Debug
advanced
2:00remaining
Why does this deep link handler fail to navigate?
Given this Swift code snippet in the app delegate handling a deep link URL:
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
  if url.scheme == "myapp" {
    if url.host == "profile" {
      let userId = url.lastPathComponent
      navigateToProfile(userId: userId)
      return true
    }
  }
  return false
}

Why might the navigation not work as expected?
AThe method <code>navigateToProfile</code> is not defined in the app delegate.
BThe <code>url.lastPathComponent</code> is empty because the URL path is missing or malformed.
CThe <code>url.scheme</code> is incorrect and does not match the app's scheme.
DThe method returns false, so the system ignores the URL.
Attempts:
2 left
💡 Hint
Check how the URL path is parsed for the user ID.
🧠 Conceptual
expert
2:00remaining
How does Universal Links improve deep linking on iOS?
Which statement best describes the advantage of Universal Links over custom URL schemes for deep linking on iOS?
AUniversal Links open the app directly without showing a prompt and fallback to the website if the app is not installed.
BUniversal Links require the user to manually copy and paste URLs into the app.
CUniversal Links only work when the app is already running in the background.
DUniversal Links force the app to open a web view instead of native screens.
Attempts:
2 left
💡 Hint
Universal Links use standard web URLs and improve user experience.