0
0
iOS Swiftmobile~10 mins

Analytics and Crashlytics in iOS Swift - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import Firebase Analytics in your Swift file.

iOS Swift
import [1]
Drag options to blanks, or click blank then click option'
ASwiftUI
BFirebaseAnalytics
CFoundation
DUIKit
Attempts:
3 left
💡 Hint
Common Mistakes
Importing UIKit or Foundation instead of FirebaseAnalytics.
Forgetting to import any Firebase module.
2fill in blank
medium

Complete the code to log a custom event named "purchase" with Firebase Analytics.

iOS Swift
Analytics.[1]("purchase", parameters: ["item": "book", "price": 9.99])
Drag options to blanks, or click blank then click option'
AsendEvent
BrecordEvent
CtrackEvent
DlogEvent
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent methods like sendEvent or trackEvent.
Misspelling the method name.
3fill in blank
hard

Fix the error in the code to record a non-fatal error with Crashlytics.

iOS Swift
Crashlytics.crashlytics().[1](NSError(domain: "example", code: 123, userInfo: nil))
Drag options to blanks, or click blank then click option'
ArecordError
BreportError
ClogError
DsendError
Attempts:
3 left
💡 Hint
Common Mistakes
Using methods that do not exist in Crashlytics API.
Confusing fatal crash reporting with non-fatal error recording.
4fill in blank
hard

Fill both blanks to set a user ID and a user property in Firebase Analytics.

iOS Swift
Analytics.[1]("user_123")
Analytics.[2]("favorite_color", value: "blue")
Drag options to blanks, or click blank then click option'
AsetUserID
BsetUserProperty
ClogEvent
DrecordError
Attempts:
3 left
💡 Hint
Common Mistakes
Using logEvent instead of setUserProperty.
Confusing user ID setting with event logging.
5fill in blank
hard

Fill all three blanks to initialize Firebase, enable Crashlytics collection, and log a test event.

iOS Swift
FirebaseApp.[1]()
Crashlytics.crashlytics().[2] = true
Analytics.[3]("test_event")
Drag options to blanks, or click blank then click option'
Aconfigure
BisCrashlyticsCollectionEnabled
ClogEvent
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using start() instead of configure().
Trying to call a method instead of setting the boolean property for Crashlytics.
Using wrong method names for logging events.