Questions tagged [mainbundle]
41 questions
23
votes
7 answers
Unable to play MP4 video file from mainBundle
So I'm trying to play a simple intro animation video file that I've dragged into my project in XCode and therefore should be able to play from my mainBundle, right?
With this code:
NSURL *urlString = [NSURL fileURLWithPath:[[NSBundle mainBundle]…

PinkFloydRocks
- 808
- 3
- 14
- 29
11
votes
1 answer
Swift 3 - Copy Folder w/ contents from Main Bundle to Documents Directory
I have folders with files inside them in my main bundle, and I want to copy/cut them to the Documents Directory at first launch of the application to access them from there. I've seen examples but they're all in Obj-C and I'm using Swift 3. How can…

SergeH
- 608
- 1
- 5
- 20
7
votes
2 answers
xcode: how to save files in "documents" folder in compile/build phase (not via "code on run")?
I have a lot of jpeg+png+html files to add to my app, and of course when i "build" it all my resources files are added/included in myApp mainBundle folder.
I'd like to be able to modify via code, in run time, some of my resources, but:
1) we cannot…

meronix
- 6,175
- 1
- 23
- 36
4
votes
2 answers
CFString objects being declared by [NSBundle mainBundle]
I am working on performance improvement of my ios cocos2d game. I was checking memory allocations of the app with the help of Instruments tool when I noticed one thing. There are too many CFString objects being declared and held by [NSBundle…

Aqueel
- 1,246
- 3
- 23
- 46
3
votes
1 answer
MonoTouch - Reading in a file from the Main Bundle
I have an application which I have written in MonoTouch. I dropped a file called ARCSDev into the applications folder and included it in the project, I then tried to read in the file using the following code:
private void generateChart (int…

Jack Nutkins
- 1,555
- 5
- 36
- 71
2
votes
1 answer
Send generated audio to UILocalNotification
I have an alarm app that plays .mp3 alarms and uses one .wav for local notifications.
As an update I just spent laying down a massive amount of code setting up and upgrade system that convers the allocated MP3s into Wavs,, so the user will hear any…

Andres Canella
- 3,706
- 1
- 35
- 47
2
votes
0 answers
Scanning the contents of a directory in an app's main bundle
I have the following code:
var error: NSError?
let filesInDirectory: [String]! = fileManager.contentsOfDirectoryAtPath(tmpDir, error: &error) as? [String]
This returns a list with all of the names of the files in the app's local directory. I need…

Matt Spoon
- 2,760
- 5
- 25
- 41
2
votes
1 answer
Static library test using XCTestCase
I am creating object of ISession class which gives me singleton instance,
when object is allocated and initialized it pickup values from plist file,
I am getting nil on [[NSBundle mainBundle] pathForResource:@"Manifest" ofType:@"plist"] so that…

Abbas Mulani
- 703
- 2
- 8
- 19
2
votes
1 answer
Pre-create Array on Mac, add it to main bundle to access in iOS App
In my app I'm using selfcreated arrays of points to mask images with CGPath.
So it looks like this
let pnt1 = CGPointMake(0, 33)
let pnt2 = CGPointMake(33, 66)
let pnt3 = CGPointMake(47, 71)
let pnt4 = CGPointMake(66, 65)
let pnt5…

s1ddok
- 4,615
- 1
- 18
- 31
2
votes
1 answer
Creating a URL from mainBundle pathForResource doesn't find file
I'm trying to create an NSURL containing a link to an audio file inside my project. I've copied in the audio files (.m4a files) and I'm using this line to fill an NSURL with one of them:
NSURL *fileToBePlayed = [[NSURL alloc]…

Luke
- 9,512
- 15
- 82
- 146
1
vote
2 answers
NSBundle mainBundle not found
I'm using the split view template on the iPad.
In my MasterViewController the code:
NSBundle * bundle = [NSBundle mainBundle];
works.
In my DetailViewController the same code shows an error? I imported . It knows NSBundle but does…

DAS
- 1,941
- 2
- 27
- 38
1
vote
1 answer
Remove a js array from the Next js main bundle
There is a very large hard-coded array in my Next js application and I'm importing it in a few other places to use. Because of that, it has been included in the Next js main bundle. Since it is a very large file, I would like to remove it from the…

Gayan Charith
- 7,301
- 2
- 20
- 32
1
vote
1 answer
Add new language string file dynamically for localisation in iOS
Approach
I have implemented localization using string file as given below:
Question
Is this possible to add new language file at runtime?

Alok
- 24,880
- 6
- 40
- 67
1
vote
1 answer
NSBundle.mainBundle() returns nil
I just reinstalled my mac and Xcode. Then [NSBundle mainBundle] always returns nil for some reason I don't know.
Thank you very much!
Here is the screenshot of my debug pane:

birdenglish
- 35
- 5
1
vote
1 answer
How do I access 'lost' media assets in iOS mainBundle?
I have had a problem with a video asset not being accessible from mainBundle. I am using XCode 7 and Swift 2.0. I wrote a very simple test app.
var objects = [String]()
class ViewController: UIViewController {
override func viewDidLoad() {
…

petegrif
- 69
- 1
- 11