0
0
iOS Swiftmobile~20 mins

Analytics and Crashlytics in iOS Swift - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Firebase Analytics and Crashlytics Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
ui_behavior
intermediate
2:00remaining
What happens when you log an event with Firebase Analytics in Swift?
Consider this Swift code snippet that logs a custom event using Firebase Analytics. What is the expected behavior after this code runs?
iOS Swift
import FirebaseAnalytics

Analytics.logEvent("purchase", parameters: ["item_id": "sku123", "price": 9.99])
AThe event "purchase" with parameters is sent to Firebase Analytics and appears in the Firebase console dashboard.
BThe app crashes because the logEvent method requires a completion handler.
CNothing happens because you must call Analytics.start() before logging events.
DThe event is logged locally but never sent to Firebase servers.
Attempts:
2 left
💡 Hint
Think about how Firebase Analytics handles event logging and reporting.
lifecycle
intermediate
2:00remaining
When should you initialize Firebase Crashlytics in an iOS app?
You want to capture crashes in your iOS app using Firebase Crashlytics. At which point in the app lifecycle should you initialize Crashlytics to ensure it captures all crashes?
AAfter the user logs in successfully.
BIn the viewDidLoad() method of the first view controller.
CRight before the app enters the background state.
DIn the AppDelegate's application(_:didFinishLaunchingWithOptions:) method before returning true.
Attempts:
2 left
💡 Hint
Crashlytics needs to be ready as early as possible to catch startup crashes.
🔧 Debug
advanced
2:00remaining
Why does this Crashlytics custom key not appear in the Firebase console?
You added this code to set a custom key in Crashlytics, but the key-value pair does not show up in the Firebase Crashlytics dashboard. What is the most likely reason?
iOS Swift
import FirebaseCrashlytics

Crashlytics.crashlytics().setCustomValue("premium", forKey: "user_type")
AThe method setCustomValue is deprecated and does not work anymore.
BThe app has not crashed after setting the custom key, so Crashlytics has not sent the data yet.
CYou must call Crashlytics.crashlytics().send() manually to upload keys.
DCustom keys only appear if you set them before FirebaseApp.configure() is called.
Attempts:
2 left
💡 Hint
Think about when Crashlytics uploads crash reports and associated data.
🧠 Conceptual
advanced
2:00remaining
How does Firebase Analytics handle user privacy and data collection on iOS?
Which statement correctly describes Firebase Analytics behavior regarding user privacy on iOS devices?
AFirebase Analytics ignores user privacy settings and always collects device identifiers.
BYou must manually disable Firebase Analytics if the user opts out of tracking; it does not handle this automatically.
CFirebase Analytics automatically respects the iOS App Tracking Transparency (ATT) framework and disables IDFA collection if the user denies permission.
DFirebase Analytics only collects data when the app is in the foreground.
Attempts:
2 left
💡 Hint
Consider Apple's privacy rules and how Firebase integrates with them.
navigation
expert
2:00remaining
What is the effect of calling Crashlytics.crashlytics().crash() in your app?
You add the following line in your app code during testing. What happens when this line executes?
iOS Swift
Crashlytics.crashlytics().crash()
AThe app immediately crashes, generating a crash report sent to Firebase Crashlytics on next launch.
BThe app logs a non-fatal error but continues running without interruption.
CThe app throws a runtime exception that can be caught by a try-catch block.
DNothing happens because this method is only a placeholder and does not cause a crash.
Attempts:
2 left
💡 Hint
This method is used to test Crashlytics crash reporting.