Installation
To integrate BeiziSDK into your project, follow these steps:
- Download the latest version of BeiziSDK from the official website.
- Unzip the downloaded file to a convenient location on your machine.
- Open your project in Xcode or your preferred integrated development environment (IDE).
- Navigate to your project’s settings and find the “General” tab.
- Drag and drop the BeiziSDK framework into your project’s “Frameworks” folder.
- In the project navigator, select your project’s target and navigate to the “Build Phases” tab.
- Under “Link Binary With Libraries,” click the “+” button and add the BeiziSDK framework.
- Import the BeiziSDK module in your source files where necessary.
- Build and run your project to ensure successful integration.
Getting Started
Before you start using BeiziSDK, make sure you have created an account and obtained the necessary credentials from the BeiziSDK dashboard. Once you have your credentials, follow these steps to get started:
- Import the BeiziSDK module in your source files:
- Initialize the BeiziSDK with your credentials:
- Start using BeiziSDK by calling available methods and properties.
import BeiziSDK
BeiziClient.initialize(appId: "YOUR_APP_ID", apiKey: "YOUR_API_KEY")
SDK Features
3.1 Authentication
BeiziSDK provides a comprehensive authentication system that allows you to authenticate users securely. It supports various authentication methods, including email/password, social logins (e.g., Facebook, Google), and custom authentication providers.
3.2 Data Management
BeiziSDK offers powerful data management capabilities, allowing you to store and retrieve data efficiently. You can create collections, insert documents, update fields, query data based on specific criteria, and perform complex operations like aggregation and text search.
3.3 Real-time Messaging
With BeiziSDK, you can build real-time chat applications, collaborative tools, or any other application that requires instant messaging capabilities. BeiziSDK’s real-time messaging feature enables you to send and receive messages in real-time, create channels for group messaging, and handle notifications efficiently.
3.4 Push Notifications
BeiziSDK simplifies the process of sending push notifications to your app users. By leveraging the power of cloud-based push notification services, BeiziSDK allows you to send targeted notifications to specific users or groups, schedule notifications for future delivery, and track the delivery status of notifications.
3.5 User Management
BeiziSDK provides essential user management functionalities, such as user registration, login, and logout. It also offers features like profile management, password reset, and role-based access control, helping you build secure and scalable applications with ease.
Configuring BeiziSDK
4.1 Project Setup
Before using BeiziSDK, you need to set up your project properly. The following steps will guide you through the configuration process:
- Ensure you have installed the necessary dependencies (e.g., Cocoapods, Carthage, Swift Package Manager).
- Create a new project or open an existing project in Xcode.
- Navigate to your project’s settings and select the target for your app.
- Under the “General” tab, locate the “Frameworks, Libraries, and Embedded Content” section.
- Add the BeiziSDK framework to the project by clicking the “+” button.
- Apply any other necessary configurations (e.g., enabling push notifications, adding required entitlements).
4.2 Initialization
To initialize BeiziSDK in your app, you need to provide your app ID and API key. Here’s an example of how to initialize BeiziSDK:
BeiziClient.initialize(appId: "YOUR_APP_ID", apiKey: "YOUR_API_KEY")
4.3 SDK Configuration
To configure BeiziSDK, you can modify various settings and options according to your project’s requirements. Here are some common configurations you can make:
BeiziClient.shared.logger.logLevel = .debug
BeiziClient.shared.timeoutInterval = 30.0
Usage Examples
5.1 Authenticating Users
Authenticating users is crucial for any app. BeiziSDK provides easy-to-use methods for user authentication. Here’s an example of how to authenticate a user with their email and password:
BeiziClient.shared.authenticate(email: "user@example.com", password: "password") { result in
switch result {
case .success(let user):
print("User authenticated: \(user)")
case .failure(let error):
print("Authentication failed: \(error.localizedDescription)")
}
}
5.2 Managing Data
BeiziSDK allows you to perform various operations on data, such as creating collections, inserting documents, and querying data. Here’s an example of how to insert a new document into a collection:
let collection = BeiziClient.shared.collection("books")
let document = collection.document()
document.setData(["title": "The Great Gatsby", "author": "F. Scott Fitzgerald"]) { error in
if let error = error {
print("Error inserting document: \(error.localizedDescription)")
} else {
print("Document inserted successfully.")
}
}
5.3 Sending Real-time Messages
BeiziSDK’s real-time messaging feature enables you to send and receive messages in real-time. Here’s an example of how to send a real-time message to a specific channel:
let channel = BeiziClient.shared.channel("general")
channel.sendMessage("Hello, world!") { result in
switch result {
case .success:
print("Message sent successfully.")
case .failure(let error):
print("Failed to send message: \(error.localizedDescription)")
}
}
5.4 Handling Push Notifications
BeiziSDK makes it easy to handle push notifications in your app. Here’s an example of how to handle a push notification:
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
BeiziClient.shared.handleRemoteNotification(userInfo)
}
5.5 Managing User Accounts
BeiziSDK provides several methods for managing user accounts, such as user registration, login, and updating user profiles. Here’s an example of how to register a new user using BeiziSDK:
BeiziClient.shared.registerUser(email: "user@example.com", password: "password") { result in
switch result {
case .success(let user):
print("User registered successfully: \(user)")
case .failure(let error):
print("Registration failed: \(error.localizedDescription)")
}
}
Troubleshooting
6.1 Common Issues
If you encounter any issues while using BeiziSDK, refer to the following list of common problems and their solutions:
- Issue: SDK not initialized properly
- Issue: Framework not found
- Issue: Authentication failure
- Issue: Data not syncing
Solution: Ensure you have correctly initialized BeiziSDK with your app ID and API key.
Solution: Double-check that you have added the BeiziSDK framework to your project.
Solution: Make sure you are providing valid credentials when authenticating users.
Solution: Check your network connection and make sure the device has an active internet connection.
6.2 Frequently Asked Questions
Here are some frequently asked questions about BeiziSDK:
- Q: Can I use BeiziSDK with any programming language?
- Q: How much does BeiziSDK cost?
- Q: Can I integrate BeiziSDK with other third-party services?
A: BeiziSDK is primarily designed for use with Swift and Objective-C in iOS and macOS apps.
A: BeiziSDK offers different pricing plans based on your application’s usage requirements. Please refer to our pricing page on the official website for more information.
A: Yes, BeiziSDK seamlessly integrates with various third-party services, allowing you to enhance your app’s functionality.
API Reference
For detailed information about the BeiziSDK API, please refer to the API reference documentation available on the official website.
Support and Resources
If you need any assistance or have any questions, feel free to reach out to our support team. We also provide additional resources, such as tutorials and guides, on our website to help you make the most of BeiziSDK.