views:

116

answers:

2

I have file on local desktop.

I'm converting its url by using [NSURL fileURLWithPath: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]];

its giving error description like...

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

Please let me know whats the problem ASAP (Formatter: this is not a support site)

Thanks in advance

+1  A: 

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.

stefanB
yes. i agree with stefanB. i have file at location.but -(void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)baseURLis predefined method. is there any another method to display pptfile.?
maddy
have you tried to tweak the parameters? I haven't look at the doc but will it work when you pass baseURL:nil ?
stefanB
if we pass baseURl:nil also same response. as i post earler..
maddy
is there any another method to display ppts?..
maddy
A: 

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.

Tùng Đỗ