Bugfender
Objective-C
@interface Bugfender : NSObject
Swift
class Bugfender : NSObject
Main Bugfender interface.
-
Sets the URL of the API
Note
Usage of this function is not necessary in the general use case. Please use exclusively when directed from technical support.Warning
This method must be called before activateLogger.Declaration
Objective-C
+ (void)setApiURL:(nonnull NSURL *)url;Swift
class func setApiURL(_ url: URL)Parameters
urlURL of the API to use
-
Sets the URL of the Bugfender Dashboard
Note
Usage of this function is not necessary in the general use case. Please use exclusively when directed from technical support.Warning
This method must be called before activateLogger.Declaration
Objective-C
+ (void)setBaseURL:(nonnull NSURL *)url;Swift
class func setBaseURL(_ url: URL)Parameters
urlbase URL of the Bugfender’s dashboard
-
Activates the Bugfender logger for a specific app.
Warning
If Bugfender has already been initialized with a different app keyNSInvalidArgumentExceptionwill be thrown.Note
This method needs to be called before anyBFLogcall, otherwise they will be ignored.Declaration
Objective-C
+ (void)activateLogger:(nonnull NSString *)appKey;Swift
class func activateLogger(_ appKey: String)Parameters
appKeyThe app key of the Bugfender application, get it in bugfender.com
-
Returns the app key.
Declaration
Objective-C
+ (nullable NSString *)appKey;Swift
class func appKey() -> String?Return Value
The app key, or nil if Bugfender has not been initialized.
-
Maximum space available to store local logs. This value is represented in bytes. Default value is 5242880 (1024*1024*5 = 5MB).
Note
If maximumLocalStorageSize is 0 (zero), then there is no limit and everything will be stored locally.Declaration
Objective-C
+ (NSUInteger)maximumLocalStorageSize;Swift
class func maximumLocalStorageSize() -> UInt -
Set the maximum space available to store local logs. This value is represented in bytes. There’s a limit of 50 MB.
Declaration
Objective-C
+ (void)setMaximumLocalStorageSize:(NSUInteger)maximumLocalStorageSize;Swift
class func setMaximumLocalStorageSize(_ maximumLocalStorageSize: UInt)Parameters
maximumLocalStorageSizeMaximum size in bytes. Range accepted is from 1 MB to 50 MB. If the value provider is below this range it will be set to 1 MB, if is above the range it will be set to 50 MB
-
Deprecated
Use deviceIdentifierUrl instead.
Returns the device identifier used to identify the current device in the Bugfender website. The device identifier is constant while the application is installed in the device.
Note
This string can not be changed, but can be shown to the user or sent to your server, in order to keep a relationship between a Bugfender device and a user or some other important event in your application.
Declaration
Objective-C
+ (nonnull NSString *)deviceIdentifier;Swift
class func deviceIdentifier() -> StringReturn Value
A string identifying the device.
-
Returns a URL linking to the current device in bugfender. The device identifier is constant while the application is installed in the device.
Note
This url can be sent to your server and used to create integrations with other services. Also can be stored to keep a relationship between a Bugfender device and a user or some other important event in your application.
Declaration
Objective-C
+ (nullable NSURL *)deviceIdentifierUrl;Swift
class func deviceIdentifierUrl() -> URL?Return Value
URL linking to the device in Bugfender
-
Deprecated
Use sessionIdentifierUrl instead.
The session identifier is constant while the application is running.
Declaration
Objective-C
+ (nullable NSString *)sessionIdentifier;Swift
class func sessionIdentifier() -> String?Return Value
A string identifying the current session.
-
The session identifier url is constant while the application is running.
Note
This url can be sent to your server and used to create integrations with other services.Declaration
Objective-C
+ (nullable NSURL *)sessionIdentifierUrl;Swift
class func sessionIdentifierUrl() -> URL?Return Value
A URL linking to the current session in Bugfender.
-
Synchronizes all logs with the server all the time, regardless if this device is enabled or not.
Note
This method is useful when the logs should be sent to the server regardless if the device is enabled in the Bugfender Console.Logs are synchronized continuously while forceEnabled is active.
This command can be called anytime, and will take effect the next time the device is online.
Declaration
Objective-C
+ (void)setForceEnabled:(BOOL)enabled;Swift
class func setForceEnabled(_ enabled: Bool)Parameters
enabledWhether logs should be sent regardless of the Bugfender Console settings.
-
Gets the status of forceEnabled.
See
setForceEnabledDeclaration
Objective-C
+ (BOOL)forceEnabled;Swift
class func forceEnabled() -> Bool -
Prints messages to console for debugging purposes.
Declaration
Objective-C
+ (void)setPrintToConsole:(BOOL)enabled;Swift
class func setPrintToConsole(_ enabled: Bool)Parameters
enabledWhether printing to console is enabled or not. By default it is enabled.
-
Gets the status of printToConsole. printToConsole prints messages to console. By default it is enabled.
Declaration
Objective-C
+ (BOOL)printToConsole;Swift
class func printToConsole() -> Bool -
Logs all actions performed and screen changes in the application, such as button touches, swipes and gestures.
Declaration
Objective-C
+ (void)enableUIEventLogging;Swift
class func enableUIEventLogging() -
Logs all actions performed and screen changes in the application, such as button touches, swipes and gestures.
Declaration
Objective-C
+ (void)enableUIEventLoggingWithIgnoredViewsTags: (nonnull NSArray<NSNumber *> *)ignoredViewsTags;Swift
class func enableUIEventLogging(withIgnoredViewsTags ignoredViewsTags: [NSNumber])Parameters
ignoredViewsTagsTags of views that should not be observed and logged by Bugfender
-
Enable crash reporting tool functionality.
Declaration
Objective-C
+ (void)enableCrashReporting;Swift
class func enableCrashReporting()
-
Sets the name for the device. If the Device Name is not set, then the iOS standard device name will be automatically sent
Note
This method has to be called prior to activate logger. Otherwise, an exception will be thrown.Declaration
Objective-C
+ (void)overrideDeviceName:(nonnull NSString *)deviceName;Swift
class func overrideDeviceName(_ deviceName: String)Parameters
deviceNameDevice name that will be .
-
Sets a device detail with boolean type.
Note
Similarly to an NSDictionary, where you can set key-value pairs related to a Bugfender device.Declaration
Objective-C
+ (void)setDeviceBOOL:(BOOL)b forKey:(nonnull NSString *)key;Swift
class func setDeviceBOOL(_ b: Bool, forKey key: String)Parameters
bA boolean value.
keyKey.
-
Sets a device detail with string type.
Note
Similarly to an NSDictionary, where you can set key-value pairs related to a Bugfender device.Declaration
Objective-C
+ (void)setDeviceString:(nonnull NSString *)s forKey:(nonnull NSString *)key;Swift
class func setDeviceString(_ s: String, forKey key: String)Parameters
sA string value. The maximum length allowed is 192 bytes.
keyKey.
-
Sets a device detail with integer type.
Note
Similarly to an NSDictionary, where you can set key-value pairs related to a Bugfender device.Declaration
Objective-C
+ (void)setDeviceInteger:(UInt64)i forKey:(nonnull NSString *)key;Swift
class func setDeviceInteger(_ i: UInt64, forKey key: String)Parameters
iAn UInt64 value.
keyKey.
-
Sets a device detail with double type.
Note
Similarly to an NSDictionary, where you can set key-value pairs related to a Bugfender device.Declaration
Objective-C
+ (void)setDeviceDouble:(double)d forKey:(nonnull NSString *)key;Swift
class func setDeviceDouble(_ d: Double, forKey key: String)Parameters
dA double value.
keyKey.
-
Removes a device detail.
Note
Similarly to an NSDictionary, where you can remove an existent key-value pair related to a Bugfender device by indicating its key.Declaration
Objective-C
+ (void)removeDeviceKey:(nonnull NSString *)key;Swift
class func removeDeviceKey(_ key: String)Parameters
keyKey.
-
Bugfender extended interface for logging, which takes a simple string as log message.
Note
This command can be called anytime, and will take effect the next time the device is online. For efficiency, several log lines can be sent together to the server with some delay.Note
In Swift, prefer to use bfprint() in order to get file name and line number filled in automatically. In Objective-C you can use the BFLog or BFLog2 macros.Declaration
Objective-C
+ (void)logWithLineNumber:(NSInteger)lineNumber method:(nonnull NSString *)method file:(nonnull NSString *)file level:(BFLogLevel)level tag:(nullable NSString *)tag message:(nonnull NSString *)message;Swift
class func log(lineNumber: Int, method: String, file: String, level: BFLogLevel, tag: String?, message: String)Parameters
lineNumberThe line number of the log.
methodThe method where the log has happened.
fileThe file where the log has happened.
levelLog level.
tagTag to be applied to the log line.
messageMessage to be logged. The message will be logged verbatim, no interpretation will be performed.
-
Synchronizes all logs with the server once, regardless if this device is enabled or not.
Note
This method is useful when an error condition is detected and the logs should be sent to the server for analysis, regardless if the device is enabled in the Bugfender Console.Logs are synchronized only once. After that, the logs are again sent according to the enabled flag in the Bugfender Console.
This command can be called anytime, and will take effect the next time the device is online.
Declaration
Objective-C
+ (void)forceSendOnce;Swift
class func forceSendOnce()
-
Deprecated
Use sendIssueReturningUrlWithTitle:text: instead.
Sends an issue
Note
Sending an issue forces the logs of the current session being sent to the server, and marks the session so that it is highlighted in the web console.Declaration
Objective-C
+ (nullable NSString *)sendIssueWithTitle:(nonnull NSString *)title text:(nonnull NSString *)text;Swift
class func sendIssue(withTitle title: String, text: String) -> String?Parameters
titleShort description of the issue.
textFull details of the issue. Markdown format is accepted.
Return Value
the issue identifier
-
Sends an issue
Note
Sending an issue forces the logs of the current session being sent to the server, and marks the session so that it is highlighted in the web console.Declaration
Objective-C
+ (nullable NSURL *)sendIssueReturningUrlWithTitle:(nonnull NSString *)title text:(nonnull NSString *)text;Swift
class func sendIssueReturningUrl(withTitle title: String, text: String) -> URL?Parameters
titleShort description of the issue.
textFull details of the issue. Markdown format is accepted.
Return Value
an URL linking to the issue in Bugfender
-
Sends a crash
Note
This method will send immediately a crash to the server it doesn’t take into account if crash reporting is enabled or notDeclaration
Objective-C
+ (nullable NSURL *)sendCrashWithTitle:(nonnull NSString *)title text:(nonnull NSString *)text;Swift
class func sendCrash(withTitle title: String, text: String) -> URL?Parameters
titleShort description of the crash.
textFull details of the crarsh.
Return Value
an URL linking to the crash in Bugfender
-
+userFeedbackViewControllerWithTitle:hint: subjectPlaceholder: messagePlaceholder: sendButtonTitle: cancelButtonTitle: completion: Provides a View Controller to gather the feedback of the users and sent it to Bugfender. The returning BFUserFeedbackNavigationController has to be presented modally and it has it’s own Send and Cancel buttons
Additionally, it is possible to customize the aspect of the screen accessing BFUserFeedbackNavigationController.feedbackViewController
Declaration
Objective-C
+ (nonnull BFUserFeedbackNavigationController *) userFeedbackViewControllerWithTitle:(nonnull NSString *)title hint:(nonnull NSString *)hint subjectPlaceholder:(nonnull NSString *)subjectPlaceholder messagePlaceholder:(nonnull NSString *)messagePlaceholder sendButtonTitle:(nonnull NSString *)sendButtonTitle cancelButtonTitle:(nonnull NSString *)cancelButtonTitle completion: (void (^_Nullable)(BOOL, NSURL *_Nullable)) completionBlock;Swift
class func userFeedbackViewController(withTitle title: String, hint: String, subjectPlaceholder: String, messagePlaceholder: String, sendButtonTitle: String, cancelButtonTitle: String, completion completionBlock: ((Bool, URL?) -> Void)? = nil) -> BFUserFeedbackNavigationControllerParameters
titleTitle for the navigation bar
hintShort text at the beginning
subjectPlaceholderplaceholder in the subject textfield
messagePlaceholderplaceholder in the message textfield
sendButtonTitletitle for the send button in the navigation bar
cancelButtonTitletitle for the cancel button
Return Value
BFUserFeedbackNavigationController containing a BFUserFeedbackViewController as root view controller
-
Deprecated
Use sendUserFeedbackReturningUrlWithSubject:message: instead.
Allows to create custom UI to gather user feedback and send to Bugfender.
Declaration
Objective-C
+ (void)sendUserFeedbackWithSubject:(nonnull NSString *)subject message:(nonnull NSString *)message;Swift
class func sendUserFeedback(withSubject subject: String, message: String)Parameters
subjectsubject of the feedback
messagemessage of the feedback
-
Allows to create custom UI to gather user feedback and send to Bugfender.
Declaration
Objective-C
+ (nullable NSURL *) sendUserFeedbackReturningUrlWithSubject:(nonnull NSString *)subject message:(nonnull NSString *)message;Swift
class func sendUserFeedbackReturningUrl(withSubject subject: String, message: String) -> URL?Parameters
subjectsubject of the feedback
messagemessage of the feedback
Return Value
URL linking to Bugfender
-
Logs all logs written via NSLog or OSLog.
Declaration
Objective-C
+ (void)enableNSLogLogging;Swift
class func enableNSLogLogging() -
Logs all logs written via NSLog or OSLog.
Declaration
Objective-C
+ (void)enableNSLogLoggingWithInterceptor: (nonnull id<BFLogInterceptor>)interceptor;Swift
class func enableNSLogLogging(withInterceptor interceptor: BFLogInterceptor)Parameters
interceptorintercept the logs and allow to modify or to block them before they are sent to Bugfender
View on GitHub
Bugfender Class Reference