我正试图将AMR-NB解码支持添加到之前已成功完成的iOS应用中。但是,由于我升级了我使用的框架(PhoneGap,现在称为Cordova),我开始了一个新项目并将所有代码迁移到新项目,AMR-NB lib在链接短语期间开始出错。xCode 4.3.2链接错误,但是确实存在。为什么?
我已经检查与“文件”和“脂-info”命令。一个LIB文件,并确保脂肪LIB包含了i386的弓,而且它已经包括在连接词组在构建短语。我一直在比较新旧项目的构建设置,但发现没有运气来解决这个问题。
有谁知道我可能弄错了吗?谢谢!
更新:添加的amrFileCodec.h和CJ-Func.m的代码片段
的amrFileCodec.h
// amrFileCodec.h
// Created by Tang Xiaoping on 9/27/11.
// Copyright 2011 test. All rights reserved.
#ifndef amrFileCodec_h
#define amrFileCodec_h
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "interf_dec.h"
#include "interf_enc.h"
...
// 将AMR文件解码成WAVE文件
int DecodeAMRFileToWAVEFile(const char* pchAMRFileName, const char* pchWAVEFilename);
#endif
的CJ-Func.m
// CJ-Func.m
// iBear
// Created by Chris Jiang on 11-4-22.
// Copyright 2011 Individual. All rights reserved.
#import "CJ-Func.h"
#import "interf_dec.h"
#import "interf_enc.h"
#import "amrFileCodec.h"
@implementation MyPGPlugFunc
...
- (void)decodeAMR:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options {
NSArray *currentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *basePath = [currentPaths objectAtIndex:0];
NSString *wavDir = [basePath stringByAppendingPathComponent:@"tmp/wav"];
NSString *wavPath = [basePath stringByAppendingPathComponent:[arguments objectAtIndex:1]];
NSLog(@"[CJ-FUNC] Decoding %@ to %@", [arguments objectAtIndex:0], wavPath);
BOOL isDir = YES;
NSFileManager *fileMgr = [NSFileManager defaultManager];
if (![fileMgr fileExistsAtPath:wavDir isDirectory:&isDir]) {
if (![fileMgr createDirectoryAtPath:wavDir withIntermediateDirectories:YES attributes:nil error:nil])
NSLog(@"[CJ-FUNC] ERROR: tmp/wav directory creation failed");
else
NSLog(@"[CJ-FUNC] tmp/wav directory created");
}
[fileMgr release];
int encRes = DecodeAMRFileToWAVEFile(
[[arguments objectAtIndex:0] cStringUsingEncoding:NSASCIIStringEncoding],
[wavPath cStringUsingEncoding:NSASCIIStringEncoding]
);
if (encRes <= 0)
[self writeJavascript:[NSString stringWithFormat:@"%@();", [arguments objectAtIndex:3]]];
else
[self writeJavascript:[NSString stringWithFormat:@"%@('%@');", [arguments objectAtIndex:2], wavPath]];
}
@end
自5天以来,我一直在寻找这种类型的实现。最终成功地与您的代码。谢谢你...快乐编码。 – 2018-01-23 20:20:55