Madhu
Madhu

Reputation: 1542

working with loaddata is not working properly

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]];   

It is giving me this error:

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

Upvotes: 1

Views: 789

Answers (3)

Maddy_c45
Maddy_c45

Reputation: 36

The following may work for you:

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

Upvotes: 1

Tung Do
Tung Do

Reputation: 1533

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.

Upvotes: 0

stefanB
stefanB

Reputation: 79770

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.

Upvotes: 1

Related Questions