ShipBook gives you the power to remotely gather, search and analyze your user logs and exceptions in the cloud, on a per-user & session basis.
ShipBook works from SWIFT 4.2 (min. version 3), Objective-C and from iOS 10.
ShipBookSDK is available through:
Select File > Swift Packages > Add Package Dependency and enter
Once you have installed CocoaPods, add the following line to your Podfile and run
Add the following line to your Cartfile:
If you use Carthage to build your dependencies, make sure you have added ShipBookSDK.framework to the "Linked Frameworks and Libraries" section of your target, and have included them in your Carthage framework copying build phase.
In your AppDelegate file, add the following:
Then, add the following to
To have a log on each class you need to create a logger.
For Example, in MainViewController:
The usage of the log:
If you’d like to add a tag that isn't the name of the class you're using then you can add a custom tag:
If your logs weren't uploaded to Shipbook, or you're experiencing some other issue with Shipbook, you can enable Shipbook debug logging to track down the problem.
The SDK allows the option to associate each session with specific user information.
The best practice is to set registerUser before ShipBook.start. It will also work after this point however, it will require an additional api request.
To logout the user, add the following code to your app’s logout function.
To log the user’s screen information, add the following code
Flush all logs on the device and send them now to the server.
If you don’t want to manually add
import ShipBookSDK to each source file, you may insert the following code to the AppDelegate file:
You may use a static function in place of getLogger. This is not recommended and the caveats are listed below. When a static function activates the logger, the tag will become the filename. The usage of the log:
The usage of the log:
As mentioned, working with this static logger isn't ideal:
- Performance is slower, especially in cases where the log is closed
- The log’s information is less detailed. Ideally, you should create a logger for each class.
- The Log name can have a name collision with a local Log class.
If you are already using some kind of a logging system, you may want to write wrappers to send the logs to both systems.
When creating the wrapper on the logs, you will need to implement all the parameters of each log.
For example a wrapper for
You can also implement the function that is receiving all the messages:
The severity is an enum:
To integrate Shipbook with crashlytics just implement the completion callback of
ShipBook.start as following:
Now you'll have in crashlytics a link to the logs of the specific session. The link is in the Keys tab of the a specific crash under the key
Shipbook needs the dSYM file for the application to produce human-readable stack traces of the crash.
In Xcode, select your project from the Project Navigator.
Click on the application target.
Select the Build Phase tab in the Settings editor.
Click the + icon in the upper left corner of the main panel.
Select New Run Script Phase from the dropdown.
In the script box, add the following lines: Don't forget to adjust appId and symbolsKeyappId="<YOUR_APP_ID>"symbolsKey="<YOUR_SYMBOLS_KEY>"echo $BUILT_PRODUCTS_DIRecho UPLOADING...buildProd=$BUILT_PRODUCTS_DIRprodName=$PRODUCT_NAMEfilePath=$buildProd'/'$prodName'.app.dSYM'buildNumber=$CURRENT_PROJECT_VERSIONmarketingVersion=$MARKETING_VERSIONcurl -X POST -H "Authorization: Bearer $symbolsKey" -F "[email protected]$filePath/Contents/Resources/DWARF/$PRODUCT_NAME" \"https://api.shipbook.io/v1/apps/$appId/upload/dsym?version=$marketingVersion&build=$buildNumber"
Select for install builds only