몇 가지 이유로 iOS-App과 C++ Lib (iOS-App에서 사용) 사이의 데이터 교환 옵션을 파일별로 평가합니다.데이터 교환 Objective-C vs. C++ 파일 기반
C++는 (로컬 컴퓨터에서 잘 작동) :
void LibFacadeTest::testFileAccess()
{
this->log->info("start testFileAccess");
char filename[] = "./test.txt";
std::string result;
LibFacade *e = new LibFacade();
try
{
result = e->testFileAccess(filename);
}
catch(...)
{
this->log->error("error");
}
this->log->info("Result:" + result);
delete(e);
}
는 ARM 용으로 다시 컴파일 내가 파일 이름 매개 변수 (로그를 통해) 제대로 전달되는 것을 볼 수 있습니다 장치에서 실행하지만 아무것도 반환되지 않습니다. 여기
은 목표 - C 코드 :
LibFacade *tlb = new LibFacade();
char *testName = "blub.txt";
std::string str = tlb->testFileAccess(testName);
// Check, if file exists
NSFileManager *filemgr;
filemgr = [NSFileManager defaultManager];
if ([filemgr fileExistsAtPath: @"blub.txt" ] == YES)
NSLog (@"File exists");
else
NSLog (@"File not found");
NSError *error = nil;
NSString *myString = [NSString stringWithContentsOfFile:@"blub.txt" encoding:NSUTF8StringEncoding error:&error];
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:myString
delegate:nil cancelButtonTitle:nil destructiveButtonTitle:myString otherButtonTitles:nil];
[actionSheet showInView:self.view];
비트 신속하고 더러운,하지만 내가 볼 수있는 것은 lib 디렉토리를 사용할 수 있지만, 어떤 파일이 장치가 생성되지 않은 것입니다.
내 질문에 : 포함 된 C++ lib에서 장치 파일 시스템에 액세스하는 데 제한이 있습니까? 파일 교환을 위해 특별한 디렉토리를 사용해야합니까?