Inherits from NSObject
Declared in Bit6.h

Overview

Bit6 handles the basic interaction between the Bit6 framework and the ApplicationDelegate object and offers some generic functionality.

Tasks

Other Methods

Initialization

Controllers

Properties

Cache

Logging

Working with Groups

Working with Conversations

Getting Messages

Calls

Actions

Properties

deliveredUntil

Returns the timestamp matching the last message with status Bit6MessageStatus_Delivered.

@property (nonatomic, readonly) double deliveredUntil

Declared In

Bit6.h

readUntil

Returns the timestamp matching the last message with status Bit6MessageStatus_Read.

@property (nonatomic, readonly) double readUntil

Declared In

Bit6.h

Class Methods

activeCalls

A copy of the active Bit6CallController objects in the system.

+ (NSArray<Bit6CallController*> *)activeCalls

Return Value

an NSArray of Bit6CallController objects.

Declared In

Bit6.h

addConversation:

Adds a conversation to the system.

+ (BOOL)addConversation:(Bit6Conversation *)conversation

Parameters

conversation

a Bit6Conversation object to be added.

Return Value

YES if the conversation was added

Declared In

Bit6.h

audioPlayer

Gets the default Bit6AudioPlayerController object.

+ (Bit6AudioPlayerController *)audioPlayer

Return Value

Default Bit6AudioPlayerController object.

Declared In

Bit6.h

audioRecorder

Gets default Bit6AudioRecorderController object.

+ (Bit6AudioRecorderController *)audioRecorder

Return Value

Default Bit6AudioRecorderController object.

Declared In

Bit6.h

cacheSize

Get the size of the /Cache/bit6 directory.

+ (NSUInteger)cacheSize

Return Value

cache size in bytes.

Declared In

Bit6.h

callByUUDI:

Gets the call matching the specified uuid

+ (nullable Bit6CallController *)callByUUDI:(NSUUID *)uuid

Parameters

uuid

UUID of the call.

Return Value

the call matching the specified uuid, or nil if no call was a match.

Declared In

Bit6.h

callViewController

The in-call view controller being used during the current call.

+ (nullable Bit6CallViewController *)callViewController

Return Value

Bit6CallViewController object referencing the current in-call view controller.

Declared In

Bit6.h

calls

A copy of all the Bit6CallController objects in the system.

+ (NSArray<Bit6CallController*> *)calls

Return Value

an NSArray of Bit6CallController objects.

Declared In

Bit6.h

clearCache

Delete all the files inside the /Cache/bit6 directory. A Bit6CacheDeletedNotification will be sent once the deletion is completed.

+ (NSUInteger)clearCache

Return Value

number of files deleted.

Declared In

Bit6.h

clearCacheWithPrefix:

Delete the files inside the /Cache/bit6 directory that matches the specified prefix. A Bit6CacheDeletedNotification will be sent once the deletion is completed.

+ (NSUInteger)clearCacheWithPrefix:(NSString *)prefix

Parameters

prefix

prefix of the files to delete

Return Value

number of files deleted.

Declared In

Bit6.h

conversations

Get all the existing conversations.

+ (nullable NSArray<Bit6Conversation*> *)conversations

Return Value

the existing Bit6Conversation objects as a NSArray, or null if no session has been initiated.

Declared In

Bit6.h

createCallTo:

Creates a call object.

+ (nullable Bit6CallController *)createCallTo:(Bit6Address *)identity

Parameters

identity

address of the user to call

Return Value

call object.

Discussion

Note: If there’s an active call to the same identity then that call object will be returned.

Declared In

Bit6.h

createViewControllerForCall:

Creates a view controller to use during a call, or reuse an existing one.

+ (nullable Bit6CallViewController *)createViewControllerForCall:(Bit6CallController *)callController

Parameters

callController

call for which the viewcontroller will be generated.

Return Value

viewcontroller to use during a call.

Discussion

The class for the returned viewcontroller can be customize by adding the class name with the key ‘in_call_class_name’ in the Bit6 dictionary in the target info.plist. If set then the <+(Bit6CallViewController*)createViewController> method for that class will be called to create the viewcontroller.

Declared In

Bit6.h

currentConversation

Gets the current conversation for the application.

+ (nullable Bit6Conversation *)currentConversation

Declared In

Bit6.h

deleteConversation:completion:

Delete a conversation from the system. All the messages inside the conversation are deleted too.

+ (void)deleteConversation:(Bit6Conversation *)conversation completion:(nullable Bit6CompletionHandler)completion

Parameters

conversation

Bit6Conversation object to be deleted

completion

block to be called when the operation is completed.

Declared In

Bit6.h

deleteMessage:completion:

Deletes a message from the system.

+ (void)deleteMessage:(Bit6Message *)message completion:(nullable Bit6CompletionHandler)completion

Parameters

message

Bit6Message object to be deleted

completion

block to be called when the operation is completed.

Declared In

Bit6.h

deleteMessagesWithCompletion:

Deletes all messages from the system.

+ (void)deleteMessagesWithCompletion:(nullable Bit6CompletionHandler)completion

Parameters

completion

block to be called when the operation is completed.

Discussion

Note: Use at your own risk.

Declared In

Bit6.h

downloadAudioRecordings

Get the current configuration to download audio attachments automatically. By default it’s set to YES.

+ (BOOL)downloadAudioRecordings

Return Value

true if the audio attachments will be downloaded automatically.

Declared In

Bit6.h

downloadVideosBeforePlaying

Get the current configuration to play video attachments. By default it’s set to NO.

+ (BOOL)downloadVideosBeforePlaying

Return Value

true if the video attachments will be downloaded to be played locally. false if the video will be streamed.

Declared In

Bit6.h

groups

Get all the existing groups.

+ (nullable NSArray<Bit6Group*> *)groups

Return Value

the existing Bit6Group objects as a NSArray.

Declared In

Bit6.h

locationController

Returns the default Bit6CurrentLocationController object.

+ (Bit6CurrentLocationController *)locationController

Return Value

the default Bit6CurrentLocationController object.

Declared In

Bit6.h

logType:format:

+ (void)logType:(Bit6LogOptions)type format:(NSString *)format, ...

logType:prettyFunction:line:format:

+ (void)logType:(Bit6LogOptions)type prettyFunction:(char *)prettyFunction line:(int)line format:(NSString *)format, ...

messageWithIdentifier:completion:

Get the Bit6Message object with the specified identifier.

+ (void)messageWithIdentifier:(NSString *)identifier completion:(void ( ^ ) ( Bit6Message *__nullable msg ))completion

Parameters

identifier

identifier for the message to find.

completion

block to be called with the result of the search.

Declared In

Bit6.h

messagesInConversation:offset:length:asc:

Get the Bit6Message objects in the conversation as a NSArray.

+ (NSArray<Bit6Message*> *)messagesInConversation:(Bit6Conversation *)conversation offset:(NSInteger)offset length:(NSInteger)length asc:(BOOL)asc

Parameters

conversation

the Bit6Conversation object to get the messages from

offset

initial index to look for messages

length

number of messages to get

asc

order in which the messages will be returned

Return Value

Bit6Message objects as a NSArray.

Discussion

Let’s assume we have these messages: [1, 2, 3, 4, 5] (smaller numbers - older messages)

[Bit6 messagesInConversation:myConversation offset:1 length:2 asc:YES]; // returns [2,3]
[Bit6 messagesInConversation:myConversation offset:1 length:2 asc:NO]; // returns [3,2]
[Bit6 messagesInConversation:myConversation offset:-2 length:2 asc:NO]; // returns [5,4]
[Bit6 messagesInConversation:myConversation offset:-2 length:2 asc:YES]; // returns [4,5]
[Bit6 messagesInConversation:myConversation offset:0 length:NSIntegerMax asc:YES]; // returns all the messages [1,2,3,4,5]
[Bit6 messagesInConversation:myConversation offset:0 length:NSIntegerMax asc:NO]; // returns all the messages [5,4,3,2,1]
[Bit6 messagesInConversation:myConversation offset:-3 length:3 asc:NO]; // returns [5,4,3]
[Bit6 messagesInConversation:myConversation offset:-6 length:3 asc:NO]; // returns [2,1]

Declared In

Bit6.h

messagesWithAttachmentInConversation:asc:

Get the Bit6Message objects with attachment as a NSArray.

+ (NSArray<Bit6Message*> *)messagesWithAttachmentInConversation:(Bit6Conversation *)conversation asc:(BOOL)asc

Parameters

conversation

conversation where to do the search

asc

order in which the messages will be returned

Return Value

Bit6Message objects with attachment as a NSArray.

Declared In

Bit6.h

messagesWithAttachmentInMessages:

Get the Bit6Message objects with attachment as a NSArray.

+ (NSArray<Bit6Message*> *)messagesWithAttachmentInMessages:(NSArray<Bit6Message*> *)messages

Parameters

messages

array of Bit6Message objects where to do the search

Return Value

Bit6Message objects with attachment as a NSArray.

Declared In

Bit6.h

messagesWithOffset:length:asc:

Get the Bit6Message objects in the system as a NSArray.

+ (NSArray<Bit6Message*> *)messagesWithOffset:(NSInteger)offset length:(NSInteger)length asc:(BOOL)asc

Parameters

offset

initial index to look for messages

length

number of messages to get

asc

order in which the messages will be returned

Return Value

Bit6Message objects as a NSArray.

Declared In

Bit6.h

numberOfItemsInCache

Get the number of files inside the /Cache/bit6 directory.

+ (NSUInteger)numberOfItemsInCache

Return Value

number of files in cache.

Declared In

Bit6.h

openLocationOnMapsFromMessage:

Convenience method to open the location included in a Bit6Message object in the Apple Maps app.

+ (void)openLocationOnMapsFromMessage:(Bit6Message *)msg

Parameters

msg

A Bit6Message object with a location attached. A message has a location attached if Bit6Message.type == Bit6MessageType_Location.

Declared In

Bit6.h

playVideoFromMessage:viewController:

Plays the attached video included in a Bit6Message object using the AVPlayerViewController class.

+ (void)playVideoFromMessage:(Bit6Message *)msg viewController:(UIViewController *)vc

Parameters

msg

A Bit6Message object with a video attached. A message has a video attached if Bit6Message.type == Bit6MessageType_Attachments and Bit6Message.attachFileType == Bit6MessageFileType_VideoMP4.

vc

viewcontroller from which to present a AVPlayerViewController to play the video

Declared In

Bit6.h

pushNotification

Returns the default Bit6PushNotificationCenter object.

+ (Bit6PushNotificationCenter *)pushNotification

Return Value

the default Bit6PushNotificationCenter object.

Declared In

Bit6.h

sendNotificationToAddress:type:data:

Used to send a notification to another user. To receive the notification in the other end you can hear to the Bit6CustomRtNotification notifications.

+ (void)sendNotificationToAddress:(Bit6Address *)address type:(NSString *)type data:(nullable NSDictionary<NSString*,id> *)data

Parameters

address

The Bit6Address object to send the message

type

type of the notification to send

data

data to send in the notification. It has to be able to be converted to JSON data (check by using +[NSJSONSerialization

Declared In

Bit6.h

session

Returns the default Bit6Session object.

+ (Bit6Session *)session

Return Value

the default Bit6Session object.

Declared In

Bit6.h

setAppGroupIdentifier:

Set the AppGroup identifier (set in the Xcode project capabilities) to use with the framework.

+ (void)setAppGroupIdentifier:(NSString *)appGroupIdentifier

Parameters

appGroupIdentifier

AppGroup identifier to use.

Declared In

Bit6.h

setConversationSortingComparator:

Set the comparator block that will be used to sort the conversations.

+ (void)setConversationSortingComparator:(NSComparator)cmptr

Parameters

cmptr

new sorting comparator..

Declared In

Bit6.h

setCurrentConversation:

Set the current conversation for the application. The current conversation will have its [Bit6Conversation badge] set to 0 and it won’t consider new messages to increment this value. Set this property to nil to remove the current conversation.

+ (void)setCurrentConversation:(nullable Bit6Conversation *)conversation

Parameters

conversation

conversation to become the current conversation.

Declared In

Bit6.h

setDownloadAudioRecordings:

Set the current configuration to download audio attachments automatically. By default it’s set to YES.

+ (void)setDownloadAudioRecordings:(BOOL)flag

Parameters

flag

true if the audio attachments should be downloaded automatically.

Declared In

Bit6.h

setDownloadVideosBeforePlaying:

Set the current configuration to play video attachments. By default it’s set to NO.

+ (void)setDownloadVideosBeforePlaying:(BOOL)flag

Parameters

flag

true if the video attachments should be downloaded to be played locally. false if the video should be streamed.

Declared In

Bit6.h

setInCallClass:

Set the Bit6CallViewController subclass to be used during a call. This method should be called before [Bit6 startWithApiKey:].

+ (void)setInCallClass:(Class)value

Parameters

value

UI class to be used during a call.

Declared In

Bit6.h

setLoadOfMessagesAndGroups:

Set the current configuration to load the messages and groups. If set to NO, the messages and groups won’t be loaded from the server. By default it’s set to YES.

+ (void)setLoadOfMessagesAndGroups:(BOOL)flag

Parameters

flag

true if the messages and groups should be retrieved from the server.

Declared In

Bit6.h

setLoggingOptions:

+ (void)setLoggingOptions:(Bit6LogOptions)loggingOptions

sharedInstance

Gets the default Bit6 object.

+ (Bit6 *)sharedInstance

Return Value

Default Bit6 object.

Declared In

Bit6.h

startCallTo:streams:

Starts a VoIP call.

+ (BOOL)startCallTo:(Bit6Address *)identity streams:(Bit6CallStreams)streams

Parameters

identity

address of the user to call

streams

An integer bit mask that determines the local media that will be sent.

Return Value

NO if the call can’t be started

Declared In

Bit6.h

startCallTo:streams:mediaMode:offnet:

Starts a VoIP call.

+ (BOOL)startCallTo:(Bit6Address *)identity streams:(Bit6CallStreams)streams mediaMode:(Bit6CallMediaMode)mediaMode offnet:(BOOL)offnet

Parameters

identity

address of the user to call

streams

An integer bit mask that determines the local media that will be sent.

mediaMode

Indicates if the call will go P2P or if the server should process the media

offnet

Indicates if the call will go within the Bit6 world (set to false) or it should be a real phone call (set to true).

Return Value

NO if the call can’t be started

Declared In

Bit6.h

startPhoneCallTo:

Starts a PSTN call

+ (BOOL)startPhoneCallTo:(NSString *)phoneNumber

Parameters

phoneNumber

phoneNumber to call. Phone numbers must be in E164 format, prefixed with +. So a US (country code 1) number (555) 123-1234 must be presented as +15551231234.

Return Value

NO if the call can’t be started

Declared In

Bit6.h

startWithApiKey:

Bit6 startup method.

+ (void)startWithApiKey:(NSString *)apiKey

Parameters

apiKey

unique key for the current developer.

Declared In

Bit6.h

startWithApiKey:endPoint:

Bit6 startup method.

+ (void)startWithApiKey:(NSString *)apiKey endPoint:(NSString *)endPoint

Parameters

apiKey

unique key for the current developer.

endPoint

custom server URL

Declared In

Bit6.h

started

Returns YES if the Bit6 framework has been initialized

+ (BOOL)started

Declared In

Bit6.h

totalBadge

Gets the number of unread messages for all existing conversations.

+ (NSNumber *)totalBadge

Return Value

The number of unread messages for all existing conversations.

Discussion

This is done by adding the values of [Bit6Conversation badge] for all existing conversations

Declared In

Bit6.h

typingBeginToAddress:

Used to notify when the user starts typing.

+ (void)typingBeginToAddress:(Bit6Address *)address

Parameters

address

address where the notification will be sent

Declared In

Bit6.h

Instance Methods

init

Unavailable init. Use [Bit6 sharedInstance] instead.

- (instancetype)init

Return Value

a new instance of the class.

Declared In

Bit6.h