解决方案:Blogpost
我正在使用Titanium进行应用程序开发,并尝试创建一个新模块来扩展应用程序功能。
1)模块启动并运行 - FIX! 2)将“习俗”/功能添加到模块 - ERR。
我跟着这个http://iosguy.com/2010/09/04/presenting-pdf-files-by-yourself/ 而且我真的不确定我需要把这些功能放在哪里以及为什么我需要创建所提到的视图等等。
所以我到目前为止得到了什么: 我已经读过comas3breezepdfModule.m文件是我需要使用的文件,因此来自上面链接的函数被粘贴在这个.m文件中,如下所示:
-(CGPDFDocumentRef)openDocument:(CFURLRef)url
{
CGPDFDocumentRef myDocument = CGPDFDocumentCreateWithURL(url);
if (myDocument == NULL) {
return 0;
}
if (CGPDFDocumentIsEncrypted (myDocument)
|| !CGPDFDocumentIsUnlocked (myDocument)
|| CGPDFDocumentGetNumberOfPages(myDocument) == 0) {
CGPDFDocumentRelease(myDocument);
return 0;
}
return myDocument;
}
-(CGPDFDocumentRef)document
{
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"presentation" ofType:@"pdf"];
NSURL *url = [[NSURL alloc] initFileURLWithPath:filePath];
CGPDFDocumentRef pdfdocument = [self openDocument:(CFURLRef)url];
[url release];
return pdfdocument;
}
- (void)load {
UIViewController* controller = nil;
NSInteger numberOfPages = CGPDFDocumentGetNumberOfPages([self document]);
for (NSInteger pageIndex = 1; pageIndex <= numberOfPages; pageIndex++) {
CGPDFPageRef page = CGPDFDocumentGetPage([self document], pageIndex);
PDFPageView *pageView = [[PDFPageView alloc] initWithFrame:scrollView.bounds];
pageView.page = page;
pageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
pageView.autoresizesSubviews = YES;
pageView.backgroundColor = [UIColor whiteColor];
[scrollView addSubview:pageView];
[pageView release];
}
}
然后我尝试创建一个新的viewcontroller子类,其中我有一个PDFPageView.h和PDFPAgeView.m文件...但是我尝试和测试我仍然最终在加载中创建pageView对象时出现一堆错误功能
如下:
comas3breezepdfModule.m: error: Semantic Issue: Use of undeclared identifier 'scrollView'; did you mean 'UIScrollView'?
comas3breezepdfModule.m: error: Semantic Issue: Property 'page' not found on object of type 'PDFPageView *'
comas3breezepdfModule.m: error: Semantic Issue: Property 'autoresizingMask' not found on object of type 'PDFPageView *'
comas3breezepdfModule.m: error: Semantic Issue: Property 'autoresizesSubviews' not found on object of type 'PDFPageView *'
comas3breezepdfModule.m: error: Semantic Issue: Property 'backgroundColor' not found on object of type 'PDFPageView *'
comas3breezepdfModule.m: error: Semantic Issue: Unknown receiver 'scrollView'; did you mean 'UIScrollView'?
comas3breezepdfModule.m: warning: Semantic Issue: Method '+addSubview:' not found (return type defaults to 'id')
有人能指出我正确的方向吗?
最糟糕的是,我每天都在使用Java,JS,AS3但是只要我用xCode打开一些东西,我的思绪就会变得空白,我甚至不确定函数是什么了。 一直试图在这里花费大约5个星期的时间来理解逻辑,但感觉就像我倒退并且理解得更少......
答案 0 :(得分:0)
所有错误都表明编译器无法找到各种参数的声明。请验证您是否添加了适当的头文件,并且还合成了所有已声明的属性。
答案 1 :(得分:0)
你应该显示你的.h文件,并在其中生成错误,有一些可能性,其中之一就是PDFPage类不在你的搜索路径中....通常是文件夹(lib ..)存储框架的位置,修复方法是通过单击应用程序图标并修改构建设置来添加搜索路径....搜索路径!