AMR-NBデコードのサポートをiOSアプリケーションに追加しようとしていましたが、これは以前に成功しました。しかし、私が使用したフレームワーク(PhoneGap、現在はCordova)をアップグレードしてから、新しいプロジェクトを開始し、すべてのコードを新しいものに移行すると、AMR-NB libはリンクする際にエラーを起こします。xCode 4.3.2リンクエラーですが、アーチには存在しません。どうして?
私は「ファイル」と「リポ-info」コマンドでは.aの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日以来探しています。あなたのコードで最後に成功しました。ありがとう。ハッピーコーディング。 –