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
4
votes
1 answer

Bundle.preferredLocalizations confusion

The 3 preferredLocalizations of Bundle are so confusing that I have so many questions: Why the 2 preferredLocalizations methods are class methods but keep talking about some unspecified specific bundle as if they are called on some individual…
an0
  • 17,191
  • 12
  • 86
  • 136
4
votes
1 answer

Save/Copy a file from Bundle to Desktop using NSSavePanel

I’m creating a macOS app which ships with some .zip files within its Bundle directory. Users should be able to save these files from my app to a custom directory. I found NSSavePanel and thought it is the right approach — that’s what I have so…
ixany
  • 5,433
  • 9
  • 41
  • 65
4
votes
2 answers

Remap UIWebView root URL to [[NSBundle mainBundle] bundleURL]

I've got some HTML and some images in my iPhone app, arranged something like: html/ foo.html images/ bar.png I can get bar.png to appear in my UIWebView a couple of different ways -- either loading foo.html from an NSUrl, and walking back…
David Moles
  • 48,006
  • 27
  • 136
  • 235
4
votes
1 answer

How can I unload NSBundle?

I have a scenario in which I have localization files to be downloaded from server. I download the file at start of application and store it in folder in bundle. Like if its English file I store it in bundle under folder 'en.lproj' with name…
Chetan
  • 2,004
  • 1
  • 13
  • 21
4
votes
3 answers

Overriding preferred strings localization on the fly for testing

Using the Settings app in the iPhone simulator to switch languages is a PITA way of testing localization tweaks. I'm trying to figure out a way to switch localizations (en/fr/es/etc) on the fly in my app with a debug setting without restarting the…
Ben Zotto
  • 70,108
  • 23
  • 141
  • 204
4
votes
0 answers

Xcode unit tests for plugin bundles

I want to add unit tests into my application. Unfortunately currently the most functionality lives inside a plugin. My plugin infrastructure consists of a framework with a plugin base class and some shared helper classes and resources. Now I want to…
Julian F. Weinert
  • 7,474
  • 7
  • 59
  • 107
4
votes
1 answer

How to get CFBundleShortVersionString as a constant

I append parts to a constant base URL string in my code as such: #define BASE_URL @"https://example.com/developer/" #define PHP_SCRIPT BASE_URL @"index.php" such that the resulting PHP_SCRIPT refers to https://example.com/developer/index.php I am…
Yoga
  • 1,186
  • 1
  • 13
  • 24
4
votes
1 answer

`NSBundle.mainBundle().URLForResource` always returns `nil`

I am new to Swift and am using Xcode 6. I am attempting to read data from the app's plist file, but it is not working. The data.plist file is included in Xcode's Supporting Files group. I am using the code below: var dataList =…
lawrenceli
  • 41
  • 1
  • 3
4
votes
3 answers

Problem getting path to .plist using [[NSBundle mainBundle] pathForResource

I'm an Objective C noob, and I don't know enough to explain the following problem. This code works: NSString *plistPath = @"/Users/andrewf/MyApp/Resources/Plates.plist"; dicPlates = [[NSDictionary alloc] initWithContentsOfFile:plistPath]; My…
andrewdotcoza
  • 71
  • 1
  • 1
  • 7
4
votes
1 answer

How does the NSBundle's -load method register classes and other runtime resources with the Objective-C runtime?

Foundation's NSBundles are the best way to load dynamic code in Objective-C. The -load method dynamically loads the bundle's executable code into a running program. But, which Objective-C runtime public function does the NSBundle's -load method use…
LuisABOL
  • 2,951
  • 4
  • 25
  • 57
4
votes
2 answers

Faster way to load Nib file from a bundle in iOS?

I have an app which utilises a set of custom "controls" which are loaded on demand from Xib files using methods similar to the below: NSArray * topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"AudioPlayer" owner:self…
AustinRathe
  • 671
  • 1
  • 10
  • 21
4
votes
1 answer

How should I handle header files in a bundle?

I want to develop a program that relies on plugins (here: loadable bundles) to work. Multiple plugins are asked to use the same AFNetworking ressource to make network requests. However, I don't know where to put AFNetworking and CustomPluginProtocol…
ldiqual
  • 15,015
  • 6
  • 52
  • 90
4
votes
1 answer

Possible bundle problems - Cannot create an NSPersistentStoreCoordinator with a nil model

I want to integrate the Aviary SDK Objective-C library into Monotouch project. I use 'Monotouch Binding Project' template for this. I have built the DLL (Thanks smart people!) The project is compiled and run on the simulator. However I can NOT show…
Shturman
  • 85
  • 5
3
votes
2 answers

Using the ConnectionKit Framework Within an NSBundle

Update I've since spent time learning how to use install_name_tool & otool to do this properly, and documented the process here: Using Frameworks Within NSBundles I would like to use the Connection Kit framework within an NSBundle I am making. To…
Michael Robinson
  • 29,278
  • 12
  • 104
  • 130
3
votes
1 answer

Using XIB/NIB files contained within downloaded bundles on iOS

On the face of it, this seems a very simple problem but for some reason I can't quite get it to work. I have a magazine-style app that downloads the data for each issue in the form of a zipped bundle. Once downloaded, and unpacked, the app…
reddersky
  • 963
  • 1
  • 11
  • 28