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
8
votes
2 answers

How can I implement the service locator pattern in Cocoa Touch across multiple projects?

This is a problem which has been bugging me for a while now. I'm still pretty new with some of these patterns so you'll have to forgive me (and correct me) if I use any of the terms incorrectly. My Methodology I've created a game engine. All of…
LandonSchropp
  • 10,084
  • 22
  • 86
  • 149
8
votes
1 answer

How to transfer resource files with Static Library (How to wrap resources in bundle)?

I'm creating a Static Library for iOS applications. I almost completed it, but there is an issue with the resources. My Static Library uses a lot of images and sound files. How can I transfer it with my Static Library ? I know we can wrap it on a…
Midhun MP
  • 103,496
  • 31
  • 153
  • 200
7
votes
5 answers

How do you get the Bundle Identifier from an application's name in Cocoa?

Say you have the name of an application, Mail.app, how do you programmatically obtain com.apple.mail from the application name?
Tony
  • 36,591
  • 10
  • 48
  • 83
7
votes
2 answers

How to convert NSString path to CFURLRef (for iOS 3.1)?

I display a PDF in a UIScrollView. To do so I use: myDocumentRef = CGPDFDocumentCreateWithURL((CFURLRef)[[NSBundle mainBundle] URLForResource:@"salonMap" withExtension:@"pdf"]); Now, I try to make it work on an IOS 3.1 (NSBundle…
kheraud
  • 5,048
  • 7
  • 46
  • 75
7
votes
1 answer

macOS: Load one or other system framework at run time based on availability

I'm working on a macOS tool which uses Apple's Safari framework. When running in macOS 10.13, the tool links to and loads it from /System/Library/PrivateFrameworks/Safari.framework and all works fine. But when running in macOS 10.12.6, some…
Jerry Krinock
  • 4,860
  • 33
  • 39
7
votes
1 answer

Customising MacOS Bundle's Info.plist file with CMake

I'm using CMake generate build files for a cross platform game and want to specify custom NSMainNibFile and NSPrincipalClass values in certain bundle's Info.plist file Here's the relevant portion of my Info.plist.in…
Neil M
  • 666
  • 8
  • 14
7
votes
2 answers

Get image paths from NSBundle in Objective C?

I have about 60 images I want to store in Core Data, 30 of which are avatars and have the prefix of avt_filename_00X.png and 30 of them are smaller and have a different prefix. Rather than storing all the images as BLOBs in Core Data/SQLite, I want…
zardon
  • 2,910
  • 6
  • 37
  • 58
7
votes
2 answers

Objective C : loadNibNamed method: how does it work?

I would know how loadNibNamed of NSBundle class works; In some document I find something like [[NSBundle mainBundle] loadNibNamed:@"mynib" owner:self options:NULL]; without return value; just called inside a method (e.g. cellForRowAtIndexPath if I…
volperossa
  • 1,339
  • 20
  • 33
7
votes
5 answers

How to develop an iOS framework which includes image resources?

I am developing an iOS framework which includes image resources, I call the methods below in the framwork, crossImage = [UIImage imageNamed:@"cross"]; arrowImage = [UIImage imageNamed:@"arrow"]; and then I build a demo to test my framework, but…
Grey
  • 253
  • 4
  • 15
7
votes
2 answers

Same name of two images in different folders of NSBundle

I have two images in different folders of NSBundle having the same name. It obviously emits a warning: Warning: Multiple build commands for output file /Users/xxxxxXXXXXXXxxxxxxx.app/image.png I know that NSBundle => In NSBundle all the folders…
user2289379
6
votes
2 answers

Frameworks vs. Bundles

I want to be able to add plugins for an application I am developing and as it is a development tool I want other people to be able to write their own plugins. So my questions are what are the real differences between a framework and a loadable…
Nicholas
  • 83
  • 1
  • 6
6
votes
3 answers

NSBundle - (not loaded yet) Error

I am trying to get a strings file table for use with NSLocalizedStringFromTableInBundle. I am using this method: +(NSBundle*)getBundleForLang:(NSString*)lang{ //get the path to the bundle NSString *bundlePath = [[NSBundle mainBundle]…
shannoga
  • 19,649
  • 20
  • 104
  • 169
6
votes
1 answer

What is the infoDictionary key to get the copyright defined in the bundle?

I want to use the copyright placed in the bundle of the project "info plist." I cannot find the key documented. Does anyone know the value of the key? [[[NSBundle mainBundle] infoDictionary] objectForKey: @"key-for-copyright"]
mobibob
  • 8,670
  • 20
  • 82
  • 131
6
votes
3 answers

iOS - passing data to pushed viewcontroller

When pushing a viewcontroller, how do I pass data long with it as well (such as "asdf":123)? Are you supposed to addObjects to a NSBundle?
KaiserJohaan
  • 9,028
  • 20
  • 112
  • 199
6
votes
1 answer

Count of images in my [[NSBundle mainBundle] bundlePath]

How can you find count of images in [[NSBundle mainBundle] bundlePath] at particular my folder.... Eg: /Users/Nag/Library/Application Support/iPhone Simulator/4.2/Applications/4409487C-1035-4329-B38A-B6F21E00FC63/MakeUp_IPhone.app/"MyFolder"
Nag_iphone
  • 967
  • 7
  • 22