Inherits from NSObject
Declared in Bit6.h

Overview

Bit6 handles the basic interaction between the Bit6 framework and the ApplicationDelegate object

Class Methods

addConversation:

Adds a conversation to the system.

+ (BOOL)addConversation:(nonnull 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.

+ (nonnull Bit6AudioPlayerController *)audioPlayer

Return Value

Default Bit6AudioPlayerController object.

Declared In

Bit6.h

audioRecorder

Gets default Bit6AudioRecorderController object.

+ (nonnull Bit6AudioRecorderController *)audioRecorder

Return Value

Default Bit6AudioRecorderController object.

Declared In

Bit6.h

callControllers

List of Bit6CallController objects in the current call.

+ (nonnull NSArray<Bit6CallController*> *)callControllers

Return Value

an NSArray of Bit6CallController objects in the current call.

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

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:streams:

Creates a Bit6CallController to reference a VoIP call

+ (nullable Bit6CallController *)createCallTo:(nonnull 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

Bit6CallController object to handle the call. It returns nil if a call to the specified address is happening.

Declared In

Bit6.h

createCallToPhoneNumber:

Creates a Bit6CallController to reference a PSTN call

+ (nullable Bit6CallController *)createCallToPhoneNumber:(nonnull 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

Bit6CallController object to handle the call. It can return nil if an error occur.

Declared In

Bit6.h

deleteConversation:completion:

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

+ (void)deleteConversation:(nonnull 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:(nonnull 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

groups

Get all the existing groups.

+ (nullable NSArray<Bit6Group*> *)groups

Return Value

the existing Bit6Group objects as a NSArray.

Declared In

Bit6.h

incomingCallHandler

Returns the default Bit6IncomingCallHandler object.

+ (nonnull Bit6IncomingCallHandler *)incomingCallHandler

Return Value

the default Bit6IncomingCallHandler object.

Declared In

Bit6.h

locationController

Returns the default Bit6CurrentLocationController object.

+ (nonnull Bit6CurrentLocationController *)locationController

Return Value

the default Bit6CurrentLocationController object.

Declared In

Bit6.h

messagesInConversation:offset:length:asc:

Get the Bit6Message objects in the conversation as a NSArray.

+ (nonnull NSArray<Bit6Message*> *)messagesInConversation:(nonnull 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.

+ (nonnull NSArray<Bit6Message*> *)messagesWithAttachmentInConversation:(nonnull 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.

+ (nonnull NSArray<Bit6Message*> *)messagesWithAttachmentInMessages:(nonnull 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.

+ (nonnull 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

openLocationOnMapsFromMessage:

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

+ (void)openLocationOnMapsFromMessage:(nonnull 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 MPMoviePlayerViewController class.

+ (void)playVideoFromMessage:(nonnull Bit6Message *)msg viewController:(nonnull 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 the MPMoviePlayerViewController control to play the video

Declared In

Bit6.h

presentCallViewController:

Shows the callViewController using a modal transition.

+ (void)presentCallViewController:(nonnull Bit6CallViewController *)callViewController

Parameters

callViewController

viewController to be presented.

Declared In

Bit6.h

pushNotification

Returns the default Bit6PushNotificationCenter object.

+ (nonnull 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:(nonnull Bit6Address *)address type:(nonnull NSString *)type data:(nonnull 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.

+ (nonnull Bit6Session *)session

Return Value

the default Bit6Session object.

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

setShouldDownloadVideoBeforePlaying:

Configure the video attachments playing mode.

+ (void)setShouldDownloadVideoBeforePlaying:(BOOL)shouldDownloadVideoBeforePlaying

Parameters

shouldDownloadVideoBeforePlaying

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

Declared In

Bit6.h

shouldDownloadVideoBeforePlaying

Obtains the current configuration to play video attachments.

+ (BOOL)shouldDownloadVideoBeforePlaying

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

startWithApiKey:

Bit6 startup method. It should be the first call to Bit6 api made.

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

Parameters

apiKey

unique key for the current developer.

Declared In

Bit6.h

totalBadge

Gets the number of unread messages for all existing conversations.

+ (nonnull 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:(nonnull Bit6Address *)address

Parameters

address

address where the notification will be sent

Declared In

Bit6.h