Introduction
Welcome to the MonkeyKing Documentation! MonkeyKing is a powerful framework designed to simplify and enhance the integration of social media platforms into your iOS apps. Whether you want to enable sharing functionality, login with social media accounts, or access various platform-specific features, MonkeyKing has you covered.
Features
- Straightforward API to interact with social media platforms
- Supports major social media platforms including Facebook, Twitter, Weibo, and more
- Handle sharing and posting on social media platforms with ease
- Integrate social media login functionality into your app
- Access platform-specific features such as deep linking and app invitations
- Customize the UI for social media sharing and login actions
Installation
To integrate MonkeyKing into your iOS project, you can use CocoaPods. Simply add the following line to your Podfile:
pod 'MonkeyKing'
Usage
1. Setting Up App IDs
Before integrating MonkeyKing, you need to register your app with the respective social media platforms and obtain the necessary app IDs. Follow the instructions provided by each platform to get your app IDs ready.
2. Importing MonkeyKing
To start using MonkeyKing, import it into your project:
import MonkeyKing
3. Configuring Social Media Platforms
Configure MonkeyKing with the respective app IDs:
enum SocialPlatform {
case facebook
case twitter
case weibo
// more cases for other platforms...
}
MonkeyKing.registerAccount(.facebook(appID: "YOUR_FACEBOOK_APP_ID"))
MonkeyKing.registerAccount(.twitter(appKey: "YOUR_TWITTER_APP_KEY", appSecret: "YOUR_TWITTER_APP_SECRET"))
MonkeyKing.registerAccount(.weibo(appID: "YOUR_WEIBO_APP_ID"))
4. Sharing Content
Easily share content on registered platforms:
let shareURL = URL(string: "https://example.com")
let shareMessage = MonkeyKing.Message(
title: "Title",
description: "Description",
thumbnail: UIImage(named: "thumbnail_image"),
media: .url(shareURL)
)
MonkeyKing.share(message: shareMessage, to: .facebook) { (result) in
// Handle result
}
5. Social Media Login
Integrate social media login functionality:
MonkeyKing.oauth(for: .weibo) { (response) in
switch response {
case .success(let token):
// Successfully logged in with Weibo
case .failure(let error):
// Handle error
}
}
6. Platform-Specific Features
Take advantage of platform-specific features:
MonkeyKing.deliver(MonkeyKing.AppInvitationInfo(), to: .facebook) { result in
// Handle result
}
Conclusion
Congratulations on setting up MonkeyKing for your iOS app! Now you can easily integrate social media platforms, enable sharing functionality, and implement social media login, all with the help of MonkeyKing. For more detailed information on available methods and customizations, refer to the official MonkeyKing documentation and examples.