Alan Platform • Alan Studio • Docs • FAQ • Blog • Twitter
Create a voice script for your application in Alan Studio and then add it to your app.
- Download Alan iOS SDK framework here
- Copy framework to your project
- Add framework to "Embedded Binaries" (General tab for your target)
- Add framework to "Linked Frameworks and Libraries" (General tab for your target)
- Add NSMicrophoneUsageDescription key to Info.plist of your application (must be added to microphone access)
- Simply import AlanSDK
import AlanSDK
- Define AlanButton variable
fileprivate var button: AlanButton!
- Setup AlanButton
let config = AlanConfig(key: "YOUR_KEY_FROM_ALAN_STUDIO_HERE")
self.button = AlanButton(config: config)
- Layout button the same way as any UIView in your app
- Simply import AlanSDK
@import AlanSDK;
- Define AlanButton variable
@property (nonatomic) AlanButton* button;
- Setup AlanButton in viewDidLoad
AlanConfig* config = [[AlanConfig alloc] initWithKey:@"YOUR_KEY_FROM_ALAN_STUDIO_HERE"];
self.button = [[AlanButton alloc] initWithConfig:config];
- Layout button the same way as any UIView in your app
Object that describes parameters which will be provided for AlanButton.
- Create new AlanConfig instance with given project key:
- (instancetype)initWithKey:(NSString *)key;
Name | Type | Description |
---|---|---|
key | NSString | Project key from Alan Studio |
This class provides a view with voice button and instance methods to communicate with Alan Studio
- (instancetype)initWithConfig:(AlanConfig *)config;
Name | Type | Description |
---|---|---|
config | AlanConfig | AlanConfig object for configuration which is described above |
- (void)playText:(NSString *)text;
Name | Type | Description |
---|---|---|
text | NSString | Text to be played |
- (void)playCommand:(NSDictionary *)command;
Name | Type | Description |
---|---|---|
command | NSDictionary | Data event to be send |
- (void)setVisualState:(NSDictionary *)visualStateData;
Name | Type | Description |
---|---|---|
visualStateData | NSDictionary | Data with visual state description |
- (void)callProjectApi:(NSString *)method withData:(NSDictionary*)data callback:(void(^)(NSError *error, NSString *object))callback;
Name | Type | Description |
---|---|---|
method | NSString | Function name |
data | NSDictionary | Function params |
callback | (void(^)(NSError *error, NSString *object)) | Callback to handle result |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleEvent:) name:@"kAlanSDKEventNotification" object:nil];
- (void)handleEvent:(NSNotification*)notification
{
NSDictionary *userInfo = notification.userInfo;
NSLog(@"%@", userInfo);
}
Name | Description |
---|---|
kAlanSDKEventNotification | Notification name for Alan SDK events |
[AlanLog setEnableLogging:YES];
- Alan iOS SDK documentation
- Integration with Swift documentation
- Integration with Objective-C documentation
If you have any questions or if something is missing in the documentation, please contact us, or tweet us @alanvoiceai. We love hearing from you!).