测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可证 | MIT |
发布最近发布 | 2017年5月 |
SwiftSwift 版本 | 3.0 |
由Vuukle.com维护。
依赖项 | |
Alamofire | >= 4.3.0 |
AlamofireImage | >= 3.2.0 |
MBProgressHUD | >= 1.0.0 |
NSDate+TimeAgo | >= 1.0.6 |
'Vuukle' iOS SDK 框架与 Objective-C 和 Swift 3.0(或更高版本)兼容
•Vuukle 主页
[0. 为您的项目创建 Podfile] 如果您已经有了 Podfile,则可以跳过此步骤。
-> Run command 'cd [your project path]' (EXAMPLE: 'cd /Users/fedir/Desktop/ExampleProject')
-> Run command 'pod init' and wait for completion
-> Run command 'open -a Xcode podfile'
[1. 将 'Vuukle' 添加到 pods 列表]
platform :ios, '9.0'
target '[your project name]' do
use_frameworks!
pod 'Vuukle'
end
pod 'Vuukle'
target '[your project name]' do
...
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
[2. 为项目安装 pods]
• EXAMPLE: If you have opened ExampleProject.xcodeproj, close it. After installation of pods you will work with ExampleProject.xcworkspace
-> Run command 'cd [your project path]' (EXAMPLE: cd /Users/fedir/Desktop/ExampleProject)
-> Run command 'pod install' and wait for completion
This command will install latest version of pod 'Vuukle' and dependency pods:
• 'Alamofire' (version >= 4.3.0)
• 'AlamofireImage' (version >= 3.2.0)
• 'MBProgressHUD' (version >= 1.0.0)
• 'NSDate+TimeAgo' (version >= 1.0.6)
[3. 请添加以下参数到 info.plist]
在项目中选择info.plist文件,添加“App Transport Security Settings”,将类型“String”更改为“Dictionary”。然后为“App Transport Security Settings”添加 - Allow Arbitrary Loads,类型为“Boolean”,值为“YES”。 http://stackoverflow.com/questions/31254725/transport-security-has-blocked-a-cleartext-http
[4. 将Vuukle添加到嵌入的二进制文件中]
• EXAMPLE: In project directory open ExampleProject.xcworkspace
You can also run using terminal:
-> Run command 'cd [your project path]' (EXAMPLE: cd /Users/fedir/Desktop/ExampleProject)
-> Run command 'open ExampleProject.xcworkspace'
Tap on your project in project navigator (in top left corner)
• Select 'TARGETS' and scroll down to 'Embedded Binaries'
• Tap on '+' button and select 'Add Other...'
• Go to 'Pods -> Vuukle -> Vuukle' and select 'Vuukle.framework' file
[5. 导入Vuukle]
• EXAMPLE:
import UIKit
import Vuukle
class ExampleViewController: UIViewController {
...
[6. 打开工作空间并导入Vuukle]
EXAMPLE: In project directory open ExampleProject.xcworkspace
You can also run using terminal:
-> Run command 'cd [your project path]' (EXAMPLE: cd /Users/fedir/Desktop/ExampleProject)
-> Run command 'open ExampleProject.xcworkspace'
在项目导航器中点击您自己的项目(左上角)
• 选择'TARGETS'并滚动到' Embedded Binaries' • 点击 '+' 按钮,选择 'Add Other...' • 进入 'Pods -> Vuukle -> Vuukle',选择 'Vuukle.framework' 文件
[7. 导入Vuukle]
• 示例
#import <Vuukle/Vuukle-Swift.h>
@interface ViewController () ... @end
@implementation ViewController ...
[8. 将vuukle评论添加到内容视图以展示评论功能]
override func viewWillAppear(_ animated: Bool) { ... }
VUCommentsBuilder.addVuukleComments(baseVC: [您的视图控制器],baseScrollView: [您的主滚动视图],contentView: [Vuukle的内容视图],contentHeightConstraint: [Vuukle的内容视图高度约束],appName: [应用名称],appID: [应用bundle ID],vuukleApiKey: [Vuukle API密钥],vuukleSecretKey: [Vuukle密钥],vuukleHost: [Vuukle主机],vuukleTimeZone: [您的时区],articleTitle: [文章标题],articleID: [文章ID],articleTag: [文章标签],articleURL: [文章URL])
VUCommentsBuilder.addVuukleComments(baseVC: [您的视图控制器], contentView: [您的Vuukle内容视图], appName: [应用名称], appID: [应用包标识符], vuukleApiKey: [Vuukle API密钥], vuukleSecretKey: [Vuukle私密密钥], vuukleHost: [Vuukle主机], vuukleTimeZone: [您的时区], articleTitle: [文章标题], articleID: [文章ID], articleTag: [文章标签], articleURL: [文章URL], isScrollEnabled: true, edgeInserts: [评论边缘插入])
【9. 更新所有高度】
override func viewDidAppear(_ animated: Bool) { ... }
VUCommentsBuilder.updateAllHeights()
• 示例
override func didRotate(from fromInterfaceOrientation: UIInterfaceOrientation) { VUCommentsBuilder.updateAllHeights() }
【10. 通过您的应用程序登入】
VUCommentsBuilder.loginUser(name: [您的名称], email: [您的电子邮件])
VUCommentsBuilder.logOut()
【11. 准备就绪,可以运行项目】