开发者

working with loaddata is not working properly

I have file on local desktop.

I'm converting its url by using [NSURL fileURLW开发者_如何学PythonithPath:filePath] but I'm getting error. Here is my code:

NSString* filePath = @"/Users/Desktop/bb.ppt";
[powerWeb loadData:[NSData dataWithContentsOfFile:filePath]    
          MIMEType:@"application/vnd.ms-powerpoint"
  textEncodingName:@"utf-8"
           baseURL:[NSURL fileURLWithPath:filePath]];   

It is giving me this error:

error:::Operation could not be completed. (NSURLErrorDomain error 100.)
error:::Frame load interrupted.


The following may work for you:

[[NSBundle mainBundle] URLForResource:@"mypresentation" withExtension:@"ppt];


I suspect that this is not right:

baseURL:[NSURL fileURLWithPath:filePath]

You are using the same full path in loadData and baseURL parts.

Do you have a file at the location: /Users/Desktop/bb.ppt, even if you had it there I suspect it will try to access /Users/Desktop/bb.ppt/Users/Desktop/bb.ppt looking at the baseURL setting.


I use this code to display ppt in iPhone application:

[myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:tempFilePath]]];

But it have a leak when viewing. I don't know why.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜