The Salesforce Developers website will undergo maintenance on May 29, 2024 from 3:00 a.m. UTC to 10:00 a.m. UTC. The maintenance process may affect the availability of our documentation. Please plan accordingly.

iOS Compiler-Level Logging

Mobile SDK 7.0 simplifies iOS logging and refers it to the underlying operating system framework.

To access the logging system, call the os_log() function. This function gives you access to the Apple unified logging system. If you like, you can also pass a custom component log object and set a log level. See for details.

The Salesforce Logging Framework on iOS is not currently recommended for external use. If you have legacy code that uses SFSDKLogger, you can continue using it as follows:

  1. In each source file that uses SFSDKLogger, replace

    #import <SalesforceAnalytics/SFSDKLogger.h>


    #import <SalesforceSDKCommon/SFLogger.h>
  2. Using Xcode Refactor, replace all instances of SFSDKLogger with SFLogger.

You can replace SalesforceLogger calls in the Swift forceios template as follows. These simplistic examples use the default component logger to log debug messages in the Xcode console.