지난 몇 시간 동안의 문제로 어려움을 겪고 있습니다. 프로그래밍 방식으로 PDF를 만들고 ~/라이브러리/Application Support/iPhone Simulator/...에 저장하면 프로그램이 시뮬레이터에서 잘 작동합니다. webView에서 PDF를 저장하고 검색 할 수 있습니다.시뮬레이터에서는 pdf가 표시되지만 iPhone에서는 표시되지 않습니다.
하지만 iPhone4 기기에서 앱을 테스트 할 때 검색 할 때 PDF 파일이 표시되지 않습니다. 나는 새롭다 그래서 수동으로 수표가 장치에서 창조 된 ㄴ다는 것을 있건 없건간에 모른다.
제게 도움을주십시오.
감사
는이 코드에서 PDF로 저장 : 전에이 문제로 실행했습니다- (void)generatePdfButtonPressed{
pageSize = CGSizeMake(612, 792);
NSString *fileName = @"Demo.pdf";
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *pdfFileName = [documentsDirectory stringByAppendingPathComponent:fileName];
[self generatePdfWithFilePath:pdfFileName];
}
- (void) generatePdfWithFilePath: (NSString *)thefilePath
{
UIGraphicsBeginPDFContextToFile(thefilePath, CGRectZero, nil);
NSInteger currentPage = 0;
BOOL done = NO;
do
{
// Mark the beginning of a new page.
UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, pageSize.width, pageSize.height), nil);
// Draw a page number at the bottom of each page.
currentPage++;
//[self drawPageNumber:currentPage];
//Draw a border for each page.
// [self drawBorder];
//Draw text fo our header.
[self drawHeader];
//Draw a line below the header.
[self drawLine];
//Draw personel details
[self drawPersonelDetail];
//Draw Education
[self drawEducation];
//Draw work Experiences
[self drawWorkExperiences];
//Draw work Activities
[self drawActivities];
//Draw Skills
[self drawSkils];
//Draw some text for the page.
// [self drawText];
yCord=550;
// [self drawText];
//Draw an image
// [self drawImage];
done = YES;
}
while (!done);
// Close the PDF context and write the contents out.
UIGraphicsEndPDFContext();
}
어디에서나 로그 메시지를 추가하고 리턴 코드를 확인하고 로그하십시오. 분명히 당신이 전화로하고있는 것은 작동하지 않고 이것이 당신이 그 장소를 찾을 수있는 방법입니다. 또한 "응용 프로그램 지원"이 휴대 전화의 응용 프로그램에 미리 존재하는지 잘 모르겠습니다. 프로그래밍 방식으로 작성해야 할 수도 있습니다. (내가 말했던 것처럼 확실하지는 않습니다.) –
@DavidH 답장을 보내 주셔서 감사합니다. 나는 알고 싶어한다. 내 장치에 pdf를 저장하는 것을 올바르게 코딩하고 있습니까? (시뮬레이터에서 잘 작동합니다.) – QueueOverFlow
또한 생성 한 파일 경로를 저장하는 방법과 PDF를 웹보기로로드하려는 방법이 표시되지 않습니다. –