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
5
votes
3 answers

Get file path from NSBundle in Swift

I have a file stored in: /var/mobile/Containers/Data/Application/083EA15E7/Documents/myFile.zip It got there after I downloaded it from a server. If I know the file name is myFile.zip, how can I find it with NSBundle? Like this: if let URL =…
matt
  • 2,312
  • 5
  • 34
  • 57
5
votes
1 answer

XCTest fails when calling [NSBundle mainBundle]

I have some code that calls [NSBundle mainBundle] at some point, mainly to read/set preferences. When I unit test the method, the test fails because the test's mainBundle does not contain the file. This is a known issue, that Apple won't fix as…
KPM
  • 10,558
  • 3
  • 45
  • 66
5
votes
1 answer

External Object in storyboards

It's some time Apple has provided us with storyboards, I'm following its' evolution since the very beginning, it has some pros and cons, but for sure this is a "future" if you compare it to the oldschool "xib" files... What I'm aware of here is…
kprofic
  • 51
  • 2
5
votes
2 answers

Trying to replace deprecated loadnibnamed:owner

I'm trying to replace the deprecated [NSBundle loadNibNamed:@"Subscriptions" owner:self]; with this instead (only thing I can find that's equivalent) [[NSBundle mainBundle] loadNibNamed:@"Subscriptions" owner:self topLevelObjects:nil]; but the…
Ryan Knopp
  • 582
  • 1
  • 4
  • 12
5
votes
8 answers

Xamarin Studio. Monotouch. Could not load NIB in bundle ... with name

When I test the app on the simulator, I get the following: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Could not load NIB in bundle: 'NSBundle <...> (loaded)' with name '...Controller' But when I use the actual…
nightsnaker
  • 471
  • 6
  • 16
5
votes
1 answer

iOS: Is there any way to fake the user's locale?

I'm interested in allowing my users to choose the language / locale my app appears to them in. I have figured out how to load the right bundle, choose the correct strings files, etc. However, some system items I still seem to have no control over.…
Mike
  • 1,112
  • 1
  • 13
  • 20
5
votes
1 answer

xcode target dependencies between two projects

I have a problem with setting dependencies in XCode 4 between separate projects. Currently, I have two projects in the same workspace. The first project have a Framework amongst it's products. I would like to use this framework in the second…
notsurewhattodo
  • 446
  • 4
  • 11
5
votes
3 answers

Using NSBundle to load my resources

I wanted to separate my resources, nib files and localization files into a common reusable bundle. And so I created a bundle for my ios application and specified resources to be included inside the bundle using build phases, copy bundle resources.…
Sandeep
  • 20,908
  • 7
  • 66
  • 106
5
votes
2 answers

NSBundle "not yet loaded" for existing path

I'm trying to implement a way to change language inside the application. I think I have it all figured it out, but for some reason the folder is not laded as a bundle I have a folder called kh.lproj NSString *path = [[NSBundle mainBundle]…
Erik
  • 5,791
  • 5
  • 30
  • 45
4
votes
0 answers

Implementing plugin architecture for iOS using Bundles

Quite a broad question. I'm looking to refactor an existing game app so that we have a base framework for games, which are extended with some kind of modular plugin architecture. So we have: GameCore - lots of base classes, etc. GameBundle A/B/C...…
Jonathan Crooke
  • 912
  • 7
  • 19
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
4
votes
3 answers

iPhone app crashes on device but not simulator. Accessing local files with UIWebView, possible [NSBundle mainBundle] issue?

I was hoping you guys could help me what is wrong with my code that is causing my app to crash on my device but not the simulator. It is a very simple app, I just have local files displayed in a UIWebView. Here is what I am using in my .m NSString…
davis
  • 1,911
  • 6
  • 26
  • 50
4
votes
1 answer

No "kCFBundleVersionKey" sometimes: all possible scenarios?

I have a code like this in my app: NSString* version = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]; In most cases it works, and returns the Bundle version, but sometimes (let's say in 2% of cases) it returns…
olha
  • 2,132
  • 1
  • 18
  • 39
4
votes
1 answer

loadable bundle for plists

I have a main project and a static library project inside the main project. I want few plists in my static library project. Since there is no resource directory it is not possible to add plists directly, What is did is this. 1.Added a loadable…
thndrkiss
  • 4,515
  • 8
  • 57
  • 96
4
votes
2 answers

Can't swizzle class methods

I'm working on making a plugin for Mail.app. I'd like the plugin to add a button to Mail's toolbar. To do this, I decided the best approach would be to call the function to add this button in the MessageViewer's initialize method (MessageViewer is…
Aaron
  • 879
  • 7
  • 18