开发者

Documents/Images display fine in Simulator, but not on my device

开发者 https://www.devze.com 2022-12-30 18:18 出处:网络
My application is running fine on the simulator, but not on the device.Basically, any documents fro开发者_运维问答m the web (PDF, Word, M4P videos) are working great on the simulator (and can be acces

My application is running fine on the simulator, but not on the device. Basically, any documents fro开发者_运维问答m the web (PDF, Word, M4P videos) are working great on the simulator (and can be accessed from Safari on the iPhone). However, running on the iPhone, they don't display anything. Here's some sample code:

    // Set up the URL
documentViewController.documentUrl =  [NSURL URLWithString:[NSString stringWithFormat:mobileContentUrl]];
    // mobileContentUrl is something like: http://www.myserver.com/pathitem/Video.mp4" and can be accessed from Safari
[self.navigationController pushViewController:documentViewController animated:YES];

Within documentViewController I have:

- (void)viewDidLoad {
    [super viewDidLoad];
    [webView loadRequest:[NSURLRequest requestWithURL:documentUrl]];
} 

As I said, works like a charm in the Simulator...What could possibly causing this NOT to work on iPhone? How do I debug the issue???


The most likely cause is that you're trying to load a format that isn't supported by the phone. The Simulator uses many libraries from the Mac, so it often has much greater support than is available on the phone.

Can you access these URLs using MobileSafari on the phone?


PDF should work on the iPhone, as long as it doesn't require too much memory to display. The Simulator has pretty much unlimited memory while the iPhone is limited by the hardware, which I'm not sure but I think you have about 32 MB to play with on the oldest iPhones.

I'm not sure about the other formats. When you wrote M4P, did you mean mp4, or do you really mean M4P, because that is a protected AAC file that the iTunes Music Store uses, and you can't play those except through certain methods that enforce copy protection.

0

精彩评论

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