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

  • SEARCH
  • Home
  • 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 8473515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:22:21+00:00 2026-06-10T17:22:21+00:00

My app is bundled with two preinstalled videos, and the user can purchase more

  • 0

My app is bundled with two preinstalled videos, and the user can purchase more through in-app-purchase.

Each video episode is an objective-C object with an ivar called _videoFilePath (property NSString* videoFilePath)

When a video finished downloading, the file path is appropriately set. For preinstalled episodes, it is set once at startup with code like this:

NSString* fileName = [NSString stringWithFormat:@"Chapter_%03d", _episodeNumber];
self.videoFilePath = [[NSBundle mainBundle] pathForResource:fileName ofType:@"m4v"];

(Episode metadata is initialized from a bundled .plist on the first run, and a copy of that .plist is saved in /Documents and used on subsequent runs. This is because the metadata is read/write, but bundled resources are read-only)

I’ve noticed that some users can play the preinstalled videos after upgrading my app. I am currently investigating this, so I deleted the app from the Device, installed version 1.0 (from Xcode->Run), Archived version 1.1 as AdHoc and installed that on top.
As expected, the preinstalled episodes won’t play.

So this time I built/run version 1.1 from Xcode, on top of the AdHoc install, with some breakpoints enabled.

Purchased (downloaded) episodes are saved to the cache, so the presence of a valid file path is not enough to guarantee playback (might be deleted by the system). So I use NSFileMananger to check if the file exists before attempting playback, with code like this:

if (_videoFilePath) {
        // Video File Path is Set...

        if ([[NSFileManager defaultManager] fileExistsAtPath:_videoFilePath]) {
            // ...and file exists in system; 
            // Can Play:

            return YES;                
        }
        else{
            // ...but file has been deleted, possibly as a result of a 
            // restore from iTunes backup; 
            // Can Not Play:

            return NO;
        }
    }

The breakpoints revealed that the fileExistsAtPath: test fails; However the console shows the value of _videoFilePath as:

/var/mobile/Applications/CEAA80EF-A85F-4C60-929D-9BA18E8D1702/[App Name]/Chapter_001.m4v

So, what gives?

Note: Deleting the app and reinstalling version 1.1 seems to fix the problem.
The bug only manifests itself when you upgrade to 1.1 on top of 1.0.

ADDENDUM

After a second of thought (writing things down does help), I think I’ve figured it out. The file path for the resource is obtained on the first run of version 1.0, and saved in the /Documents folder with the rest of the metadata. On upgrade, I assume the ‘Random numbers, letters and hyphens’ part of the app’s path changes to something else, and thus the ‘hard-coded’ path from version 1.0 becomes a broken URL. Must NSLog the full path on both v1.0 and v1.1 to confirm this, but I think I got it.
Answers and comments are still welcome.

  • 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-06-10T17:22:22+00:00Added an answer on June 10, 2026 at 5:22 pm

    So, as I realized after some thought, the full path for bundled resources seems to change slightly on each upgrade of the app; Specifically, the “Long, autogenerated random string of numbers and letter” intermediate directory. My mistake was in saving (i.e., hard-coding) the path on the first install, and using that value even after app upgrades.
    I solved it by not caching the path and instead using

    -pathForResource:ofType:
    

    each time.

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

Sidebar

Related Questions

My requirement is to play local (bundled with the app) audio and video files
i set my in app purchase creating two bundle id's .i created a test
I have two apps in the app store, both through MonoTouch but after upgrading
I have successfully created an app that reads from a bundled .plist file and
I got a app who has Sonata User bundle and Sonata Admin bundle ,
i created a network Application to transfer text message between two devices through WiFi
package one.two; import android.app.Activity; import android.database.Cursor; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.SimpleCursorAdapter;
Booking.java package one.two; import android.app.Activity; import android.database.Cursor; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.SimpleCursorAdapter; import
I have two versions of my app. I'm trying to keep a copy of
I currently have widget for my app Hire A Droid bundled with the main

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.