语音分享应用ios源码项目

该源码是语音分享应用源码,本demo使用了科大讯飞语音识别作为分享内容的输入方式,同时也支持手动键盘输入分享内容,限制分享内容文字不能超过180个字符,分享内容输入完成后可以直接分享,分享SDK使用的时友盟社会化分享。

- (IBAction)voiceRecognize:(id)sender {
    [self.textView resignFirstResponder];
     
    _result = @"";
     
    [_iflyRecognizerView start];
}
- (void)onResult:(NSArray *)resultArray isLast:(BOOL)isLast
{
    NSDictionary *dic = [resultArray objectAtIndex:0];
    NSMutableString *result = [NSMutableString new];
    NSLog(@"DIC:%@",dic);
    for (NSString *key in dic) {
        [result appendFormat:@"%@",key];
    }
    NSLog(@"result:%@",result);
     
    _result = [NSString stringWithFormat:@"%@%@",_result,result];
     
    if (isLast) {
        if (_result == nil||[_result isEqualToString:@""]) {
            UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"无法识别,请再说一遍" message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
            [alert show];
        }else{
            self.textView.text = _result;
        }
    }
}

相关推荐