nsbundle

Customising MacOS Bundle's Info.plist file with CMake

耗尽温柔 提交于 2020-05-13 06:14:19
问题 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 template: <key>NSMainNibFile</key> <string>${MAIN_NIBFILE}</string> <key>NSPrincipalClass</key> <string>${PRINCIPAL_CLASS}</string> What I'm doing in my CMakeLists.txt is: set_target_properties(GLWindow PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "OpenGL Test" MAIN_NIBFILE "MainMenu"

How to load a `.xib` / `.nib` file within a framework?

痞子三分冷 提交于 2020-01-30 12:26:09
问题 I'm working on an iOS library as a Cocoa Pod. In this library, I have a custom view: @interface PlayerView : UIView @property (strong, nonatomic) IBOutlet UIView *contentView; @end @implementation PlayerView - (instancetype) initWithCoder:(NSCoder*)coder { self = [super initWithCoder:coder]; [self initialize]; return self; } - (instancetype) initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; [self initialize]; return self; } - (void)initialize { [[NSBundle mainBundle]

How do I pass a url to NSBundle for xml parsing with AEXML?

柔情痞子 提交于 2020-01-25 23:12:24
问题 I'm using AEXML and would like to pass XML from a REST service into the AEXML parser. However, in the example code provided the author passes a local xml file into his parser. Based on the example provided I can't seem to figure out how to pass xml data that was received via URL. I have tried capturing the url and parsing it with NSXMLParser before passing it to the bundler but that didn't work. I've also tried creating an NSData object from the URL stream. So it leads me to the question. How

How do I pass a url to NSBundle for xml parsing with AEXML?

蹲街弑〆低调 提交于 2020-01-25 23:11:13
问题 I'm using AEXML and would like to pass XML from a REST service into the AEXML parser. However, in the example code provided the author passes a local xml file into his parser. Based on the example provided I can't seem to figure out how to pass xml data that was received via URL. I have tried capturing the url and parsing it with NSXMLParser before passing it to the bundler but that didn't work. I've also tried creating an NSData object from the URL stream. So it leads me to the question. How

NSInternalInconsistencyException Could not load nib ind bundle

余生长醉 提交于 2020-01-23 06:27:26
问题 I am developing an application for the iPad. The application has following details: Base SDK: 4.2 Deployment Target: 3.2 The application is a game application and it has got 10 rounds. In each round I am loading 6 controllers and after the completion of each round again the same cycle starts. The application works fine till 4 rounds but at the end of 4th round it crashes given following error: "NSInternalInconsistencyException Could not load nib ind bundle:" I have checked for everything

NSTask launch path not accessible

微笑、不失礼 提交于 2020-01-19 15:50:07
问题 I am using the following code in my Cocoa project to call a script I made. The script is in the same folder as the project and even shows up under the "Resources" folder in Xcode. The proper path is found, but it still says that the path is not accessible. Help please. NSBundle *mainBundle=[NSBundle mainBundle]; NSString *path=[mainBundle pathForResource:@"script" ofType:@"sh"]; NSTask *task = [[NSTask alloc] init]; [task setLaunchPath: path]; NSLog (path); NSPipe *pipe = [NSPipe pipe]; [task

Get a list of all SpriteKit Scenes in App Bundle

浪子不回头ぞ 提交于 2020-01-16 19:24:48
问题 As a followup to this question, I need to iterate over each .sks file in a folder, namely, "Levels". My project looks like this: Here's what I've written: let directory = NSFileManager.defaultManager().currentDirectoryPath let paths = NSBundle.mainBundle().pathsForResourcesOfType("sks", inDirectory: directory) let files = paths.map() { (path : AnyObject) -> String in return (path as String).lastPathComponent } println("Files\n\(files)") let firstLevel = files[0] if let scene = SKScene

What is NSBundle and mainBundle in objective C?

北城以北 提交于 2020-01-11 16:47:30
问题 I want to ask a question about the objective C on iPhone 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 word. Can anyone tell me about that? Thank you very much. 回答1: A bundle is a structure used for packaging software on Mac OS X. Applications, frameworks and plug-ins are all different kinds of bundles. Bundles may

What is NSBundle and mainBundle in objective C?

≡放荡痞女 提交于 2020-01-11 16:46:22
问题 I want to ask a question about the objective C on iPhone 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 word. Can anyone tell me about that? Thank you very much. 回答1: A bundle is a structure used for packaging software on Mac OS X. Applications, frameworks and plug-ins are all different kinds of bundles. Bundles may

Copy images from an app to Documents Directory and rewrite them after it

房东的猫 提交于 2020-01-05 03:43:11
问题 I have an app where I have a certain amount of .jpg pictures (roughly 300). They serve as something to start with, because they're actually located in the internet, but obviously it's more convenient for user not to download all of them at the first start of the App, but to have them pre-packed. I am required to rewrite these images everytime I get new information from server. Obviously, I can't touch the app bundle, so I see my steps like this: Unpack the images from bundle to the Documents