매우 간단합니다.EXC_BAD_ACCESS, 표준 C 라이브러리 iphone에서 "열기"?
open()을 호출 할 때 응용 프로그램이 작동하지 않더라도 아래 코드는 관련 코드의 일부입니다. filename은 가비지 값이 아니며 파일의 절대 경로를 포함합니다. 이것은 장치 및 시뮬레이터에서 실패합니다. 파일 이름 반환
의 printf :
/사용자/programmingstation7/라이브러리/응용 프로그램 지원/아이폰 시뮬레이터/4.3/응용 프로그램/E2BD16DB-FFBA-45D2-B425-96C981380B85이/문서/issue2.zip
관련 역 추적 :
#0 0x002132dc in open()
#1 0x000ddcec in -[ExternalZipInstaller
unzipTheFile] (self=0x68a8d60, _cmd=0x1483f3) at
ExternalZipInstaller.mm:261
코드 :
012 3,516,#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
#ifndef O_BINARY
#define O_BINARY 0
#endif
- (void) unzipTheFile
{
BOOL success = YES;
const char* filename = [self.zipName UTF8String];
open(filename, O_RDONLY | O_BINARY);
전체 스택 추적이란 무엇입니까? printf ("% s \ n", filename)''open'을 호출하기 전에 어떻게됩니까? –
올바른 파일 이름을 문자열 리터럴로 하드 코딩하면 어떻게됩니까? –
"/ Users/programmingstation7/Library/Application Support/iPhone 시뮬레이터/4.3/응용 프로그램/E2BD16DB-FFBA-45D2-B425-96C981380B85/Documents/issue2.zip"backtrace :'# 0 0x002132dc in open() # 1 0x000ddcec - ExternalZipInstaller.mm에서 [ExternalZipInstaller unzipTheFile] (자기 = 0x68a8d60, _cmd = 0x1483f3는) : 261' – michael