Omega_Keyboard_SDK_Sample_iOS
请向 info.plist 添加以下项目。
隐私 - 照片库使用描述 "请填写使用目的。" 示例:用作键盘的背景图片。
将 OmegaSDKResouce 和 OmegaSDK 文件夹的内容添加到“文件”中。
键盘扩展
将 OmegaSDKResouce 和 OmegaSDK 文件夹的内容添加到“键盘扩展”中。
omega.json 设置
请更改到正确的值。
{
"appStoreID": "1078897849",
"appGroupName": "group.com.omega-app.SampleOmegaAppSDK",
"mediaSymbol": "TEST_APP",
"mediaToken": "07e13a7031a5ff5555a79d8337802e0b",
"adToken": "1095353",
"Scheme": "TEST_APP://",
"email": "[email protected]",
"HelpContents": "https://www.omega-inc.co/faq",
"TermsOfService": "https://www.omega-inc.co/tos",
"PrivacyPolicy": "https://www.omega-inc.co/privacypolicy"
}
Cocoapod 设置
请使用 Cocoapod 集成以下库。
pod "RSKImageCropper", "1.4.1" pod "PagingMenuController", "1.4.0"
构建阶段中的Copy File设置
请将以下SDK添加到构建阶段中的Copy File:
能力
由于应用程序本身的“能力”中包含“App Groups”,因此请将其设置为“开启”。请添加App Groups的ID并勾选复选框。“+”按钮可以用来添加。
与上面相同,键盘的目标在“能力”中也包含“App Groups”,因此请将其设置为“开启”。请添加App Groups的ID并勾选复选框。“*”请使用与应用程序本体相同的ID。
ATS
请将键盘-side的info.plist设置中的ATS配置项“App Transport Security Settings”下的“Allow Arbitrary Loads”设置为“是”。目前正在考虑ATS的设置。
同样,请将“NSExtensionAttributes”添加到info.plist中。将值设置为“Dictionaly”,并在其下插入以下四个项:
最后,请将键盘-side的代码与示例中的“KeyboardViewController”中的代码保持相同。
import UIKit
class KeyboardViewController: UIInputViewController {
@IBOutlet var nextKeyboardButton: UIButton!
override func updateViewConstraints() {
super.updateViewConstraints()
// Add custom view sizing constraints here
}
override func viewDidLoad() {
super.viewDidLoad()
// Perform custom UI setup here
self.nextKeyboardButton = UIButton(type: .system)
self.nextKeyboardButton.setTitle(NSLocalizedString("Next Keyboard", comment: "Title for 'Next Keyboard' button"), for: [])
self.nextKeyboardButton.sizeToFit()
self.nextKeyboardButton.translatesAutoresizingMaskIntoConstraints = false
self.nextKeyboardButton.addTarget(self, action: #selector(handleInputModeList(from:with:)), for: .allTouchEvents)
self.view.addSubview(self.nextKeyboardButton)
self.nextKeyboardButton.leftAnchor.constraint(equalTo: self.view.leftAnchor).isActive = true
self.nextKeyboardButton.bottomAnchor.constraint(equalTo: self.view.bottomAnchor).isActive = true
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated
}
override func textWillChange(_ textInput: UITextInput?) {
// The app is about to change the document's contents. Perform any preparation here.
}
override func textDidChange(_ textInput: UITextInput?) {
// The app has just changed the document's contents, the document context has been updated.
var textColor: UIColor
let proxy = self.textDocumentProxy
if proxy.keyboardAppearance == UIKeyboardAppearance.dark {
textColor = UIColor.white
} else {
textColor = UIColor.black
}
self.nextKeyboardButton.setTitleColor(textColor, for: [])
}
}
在这里,运行“Run”后,应用程序可以顺利地安装到模拟器或真实设备上。
注意事项: