Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7640913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:47:31+00:00 2026-05-31T08:47:31+00:00

The NSURL object returned by pathForResource is null for custom imported movie files. -(NSURL

  • 0

The NSURL object returned by pathForResource is null for custom imported movie files.

 -(NSURL *)localMovieURL
{
    NSURL *theMovieURL = nil;
    NSBundle *bundle = [NSBundle mainBundle];
    if (bundle) 
    {
          NSString *moviePath = [bundle pathForResource:@"Movie"      ofType:@"m4v"];
        //NSString *moviePath = [bundle pathForResource:@"Movie_01"   ofType:@"m4v"]; 
        //NSString *moviePath = [bundle pathForResource:@"Sample"     ofType:@"m4v"];
    if (moviePath)
    {   
        theMovieURL = [NSURL fileURLWithPath:moviePath];
        }

    NSLog(@" MMM moviePath   = %@", moviePath);
    NSLog(@" UUU theMovieURL = %@", theMovieURL);

}

return theMovieURL;

}

Consider the above sample code from Apple (Sample Project name – MoviePlayer)

https://developer.apple.com/library/ios/navigation/index.html?section=Resource+Types&topic=Sample+Code

Movie.m4v comes with the sample and the compiled sample project plays the m4v with no problem at all. But when I make a copy of Movie.m4v, name it Movie_01.m4v and drag the file into the project, the MPMoviePlayerController has no response. Also the added NSLog output (begins with MMM and UUU becomes “…= (null)”. The same goes for the sample m4v “Sample.m4v” which I make myself with iMovie.

This question is related to the question I posted earlier (here). My previous question involves a project which I wrote myself and it has the same problem : The “pathForResource” method returns “nil” even the movie files are seemingly properly imported. The sample movies can all play perfectly inside Xcode and I have imported (drag) png photo files into the project in the same way. But the png photos can be displayed by the compiled program both on the phone and the simulator as expected.

Hope somebody can give some hints.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T08:47:32+00:00Added an answer on May 31, 2026 at 8:47 am

    It seems you duplicated your question. Both answers seems to be: add the movie to your application bundle (Project Build Steps > Copy Resources)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Considering the code: soundFilePath = [[NSBundle mainBundle] pathForResource: @Sound ofType: @wav]; fileURL = [[NSURL
I initialize an AVAudioPlayer instance: NSString* path = [[NSBundle mainBundle] pathForResource:@foo ofType:@wav]; AVAudioPlayer* player
I'm trying to convert the following NSString api call to a NSURL object: http://beta.com/api/token=
I have an NSURL object which gets data from my site, based on a
I want to load a webview without cache? //Create a URL object. NSURL *url
NSURL *url = [NSURL URLWithString:@http://localhost/News]; NSString *jsonString = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil]; NSLog(@%@, jsonString);
What's an efficient way to take an NSURL object such as the following: foo://name/12345
I have an object that encapsulates an asynchronous NSURL request. When should I release
I have a NSURL object which gives me the path of a local file
I have a window with a custom view object. The custom view displays an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.