Questions tagged [nsbundle]

An NSBundle object represents a location in the file system that groups code and resources that can be used in a program. NSBundle objects locate program resources, dynamically load and unload executable code, and assist in localization. You build a bundle in Xcode using one of these project types: Application, Framework, plug-ins.

An NSBundle object represents a location in the file system that groups code and resources that can be used in a program. NSBundle objects locate program resources, dynamically load and unload executable code, and assist in localization. You build a bundle in Xcode using one of these project types: Application, Framework, plug-ins.

568 questions
37
votes
7 answers

How to use Core Data's ManagedObjectModel inside a framework?

I'm trying to migrate a specific part of one of my apps into a framework so that I can use it in my app itself and in one of those fancy new iOS 8 widgets. This part is the one that handles all my data in Core Data. It's pretty straight forward to…
flohei
  • 5,248
  • 10
  • 36
  • 61
36
votes
7 answers

NSBundle.mainBundle().pathForResource returns nil

I am trying to write a simple IO wrapper for Swift. To test this I have a file named "Test.txt" in my project root. I have added this file to Build Phases within Build Bundle Resources, as suggested by everyone else who has had this problem. I have…
JaminB
  • 778
  • 3
  • 9
  • 20
34
votes
3 answers

Get the main app bundle from within extension

Is it possible to get the containing app's NSBundle from within an app extension? I would like to get the main app's display name, not the extension's display name.
Jordan H
  • 52,571
  • 37
  • 201
  • 351
32
votes
12 answers

How to get the current application icon in ios

Is there a way to get the current application icon in a cocoa-touch app? Thank you.
the Reverend
  • 12,305
  • 10
  • 66
  • 121
32
votes
3 answers

What is NSBundle and mainBundle in Objective-C?

Regarding Objective-C on iOS application, I read some sample program in the Apple developer website and I found that almost all of the applications contains a word called 'NSBundle' and 'mainBundle', and I really don't understand the meaning of this…
Questions
  • 20,055
  • 29
  • 72
  • 101
30
votes
4 answers

Getting bundle file references / paths at app launch

Suppose I have an arbitrary set of files included in the Main App Bundle. I would like to fetch the file URLs for those at launch and store them somewhere. Is this possible using NSFileManager? The documentation is unclear in that regard. Note: I…
Andrew Lauer Barinov
  • 5,694
  • 10
  • 59
  • 83
27
votes
2 answers

loading NSBundle files on iOS

I'd like to create a project that has a very flexible graphical user interface (skinnable). In order to make this possible, I'd like to load a NSBundle from an external resource, e.g. a website. The bundle should contain nibs that correspond to some…
Wolfgang Schreurs
  • 11,779
  • 7
  • 51
  • 92
24
votes
6 answers

Localizable string in Foundation.framework not found

I'm getting this log warning while using my app and I'm not sure how to deal with this message: 2014-10-21 12:57:54.472 App[7067:2540152] Localizable string "(A Document Being Saved By %@)" not found in strings table "Document" of bundle CFBundle…
Carsten
  • 1,029
  • 14
  • 29
21
votes
4 answers

Get filename and extension from filepath programmatically cocoa?

I know you can use NSBundle: NSString *filePath = [[NSBundle mainBundle] pathForResource:@"foo" ofType:@"rtf"]; to get the filepath of a file, but how would I get the filename and extension (separately) from the filepath programmatically using…
user762034
20
votes
3 answers

Get resource URL from project specific path

I need to retrieve the URL of a resource contained in my Xcode project through a path that begins in the project's directory (aka mainBundle) So if my specified path if ./snd/archer/acknowledge1.wav, I need to create a URL from that. I know I can…
mattgabor
  • 2,064
  • 6
  • 25
  • 38
19
votes
3 answers

NSBundle, plist and other resources in an Obj-c Static Library

I've created a static library in Xcode, which I am able to successfully use in other projects. However, with resources like plists, I find I must include any plists referenced in my library in the main project where the project is used. In my static…
Vik
  • 1,301
  • 4
  • 16
  • 29
18
votes
4 answers

Could not find a storyboard named 'Main' in bundle NSBundle

during the progress of my app I decided to change from using a UIStoryboard to .xib file, and now I get the error: Could not find a storyboard named 'Main' in bundle NSBundle How can I fix this problem within the Simulator part of my app?
user3863704
  • 181
  • 1
  • 1
  • 5
17
votes
3 answers

Get file path by file name from documents directory ios

In my application I download PDF files which gets stored in "Document" directory under different sub folders. Now I have file name for which I want to get its path in "Document" directory but problem is I don't know the exact sub folder under which…
ViruMax
  • 1,216
  • 3
  • 16
  • 41
17
votes
2 answers

Working with paths from [[NSBundle mainBundle] resourcePath]

I'm sure it's a very basic problem, but I'm having trouble finding anything about it. Say I've got my app in a folder, in some more folders, like this: MainFolder > SecondaryFolder > AppBundle.app > all the stuff Then, what I want to do is access…
Tom Irving
  • 10,041
  • 6
  • 47
  • 63
16
votes
4 answers

Best way of loading images from application bundle

What is the best way of loading images from the application main bundle. I am using [UIImage imageNamed: "image.png"]; But I have heard that this is not good in terms of memory usage and performance. Can anyone please give his/her feedback on it?…
Aqueel
  • 1,246
  • 3
  • 23
  • 46
1
2
3
37 38