Firebase 3 and Xcode 8 - Hide unnecessary console log output

Category: Swift
Firebase 3 and Xcode 8 - Hide unnecessary console log output

We are all excited with the release of Xcode 8 and Swift 3. But upgrading our projects most of the time turns into a headache. And Firebase did well and really was an exception not to break. But still there were some outputs in the console that are very annoying. At first you might think that these are the errors but not after a close examination.

Here are some tips how to clean your console from extra output that have turned your sweet development process into a nightmare by preventing you from enjoying console outputs of your errors or success messages.

First is Xcode 8’s dummy output:

… subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0 ...

This is something that Xcode 8 ships with and hopefully it will be gone with the update to 8.1 version. To hide this extra chunk of console log do the following:

Navigate to Product -> Scheme -> Edit Scheme. Under Arguments tab in the Environment Variables section add OS_ACTIVITY_MODE = disable. Just in case you will need that, just simply uncheck the box.

subsystem: com.apple.UIKit, category: HIDEventFiltered

Firebase Specific Notifications and Error outputs

As soon as you launch your Firebase-based project and configure the library Xcode will tell you to Validate Project Settings: Update to recommended settings. Double click the warning to perform changes.

The main issue comes later, when you run your project. In the console with many other logs you will encounter the following messages:

<FIRInstanceID/WARNING> STOP!! Will reset deviceID from memory
Failed to fetch default token Error Domain=com.firebase.iid Code=6
tcp_connection_create_with_endpoint_and_parameters 5 device-provisioning.googleapis.com 443

These log messages keep showing up in the console and making almost impossible to track real errors and your console logs. This might be happening because Firebase Auth is encountering errors in Xcode 8 due to it not being able to write values to the keychain in the simulator. To override this messages you simply need to enable Keychain Sharing in your project by navigating to your project's configuration “page”. Under Capabilities tab find Keychain Sharing and turn it ON.

STOP!! Will reset deviceID from memory
Failed to fetch default token Error Domain=com.firebase.iid Code=6

As soon as you re-run your project a new file will appear in the Project Navigator page named your_project_name.entitlements

P.S. if you encounter warnings (in my case I had 8 warnings in Xcode 8 upon launching new Firebase project) please make sure to clean your project by navigating to Product -> Clean (Shift + Command + K).

Conclusion

Hopefully you did resolve all of the warnings and you can enjoy developing your next amazing application with Firebase and Swift 3. Happy coding!