objective-c

Wipe all data stored with CoreData when the model has changed

I have an app that fetches data from the internet and uses CoreData to store them in the device, for a smoother experience. Because I use Core Data, every time my schema changes, the app crashes when I try to run it with the previous data stored on the device. What is the fastest way to detect this change and wipe all the data from the ...

method of obtaining the number of bytes

NSString str = xxxxx; [str length]; This code is number of characters. I want to get number of byte. ...

Black Arrow Status Item

I am working on a IM client for OS X, and I have the design in mind, but I need help with the code. On Snow Leopard, when you click a dock item, you get something like this: What I was thinking of was something like that: (photoshop) This is the basic idea, but it has to be resizable so that it can include more stuff, like so (stil...

NSError domains / custom domains - conventions and best practices

NSError requires a domain, which I understand segments the range of error codes. One would anticipate that there exist somewhere a registry of domain.error code but I've not been able to discover one. Supposedly this could used for looking up localized descriptions for errors. Does anyone have any set of known best practices for deali...

NSTableView keyDown: and mouseDown:

I've been working on a menubar note-taking application for Mac. It is written in Objective-C and Cocoa, and I'm using BWToolkit with it. My problem is getting keyDown: and mouseDown: events in a BWTransparentTableView which is a subclass of NSTableView. I just can't get it to work. I've tried searching the Internet, and some places say t...

problem loading url in view

i'm confused about an error while i'm trying an url in a view. while compiling i get the following 2 errors (in h-file an in m-file): Expected identifier before '*' token maybe anybody can help me out of my trouble? thanks in advance! my code: File "RssWebViewController.h": #import "RssWebViewController.h" - (void)NavigateToUrl:(...

How can I use a bit type in my iPhone app?

I'm writing an iPhone app that's a mixture of Objective-C and C. I have 32-bit integer flags throughout my code that take on only two distinct values: 0 and 1. I'd like to use a data type that's smaller than 32 bits. Is there a type that's only one bit? What is the size of "BOOL" in Objective-C? One solution I've considered is usi...

Facebook Objective-C Chat API

I am looking for a Facebook Chat API on Objective-C. I have found one for Ruby (coderrr.wordpress.com/2008/05/06/facebook-chat-api/) and have noticed that software like Adium use it. So what I would like to know is how I could make/find a working Framework for the FB Chat. Thanks, Alexandre ...

Problem when NSOutlineView cells have same value

I have a Mac OS X application that uses an NSOutlineView with two columns: key and value, where you can edit the value column. I either have a NSString or a NSDictionary in a row. The code for the value of the cells is like this: - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem...

Crash At Splash Screen, iPhone

Hi there, I have an app which when opened, displays a splash/loading screen. I had this set at 2.5 seconds before the app moved on. - (void)applicationDidFinishLaunching:(UIApplication *)application { sleep(2.5); [window addSubview:viewController.view]; [window makeKeyAndVisible]; } I now want the app to pause at the splash scre...

Can't access any outlets after using loadNibNamed

Edit: In case someone wants to look at the actual code, here it is: http://pastie.org/713951 Long story short: the problem I'm having is I can't make the window show up in the fly() function. Full Description: I'm creating a plugin for the Mac application 'Coda'. I have a controller 'Bolder', with two outlets: @class Bolder; @interf...

Is it possible to define an anonymous selector in Objective-C?

I'd like to be able to define an inline anonymous selector that a selector wherever a selector is needed as an argument. Is this possible, or do I have to just suck it up and define a method? Background: In my iPhone application I need to update my UI from another thread. To do this I use performSelectorOnMainThread:withObject:waitUnti...

Objective C/Cocoa delegate question

I have read and understand the answer given in this question: http://stackoverflow.com/questions/626898/how-do-i-create-delegates-in-objective-c However, I wish to set a delegate to my main application window and was wondering where in my application I can do that - in my AppDelegate class, or somewhere else? ...

insertNewObjectForEntityForName:

Boy oh boy, do I have a question that should overflow your stack. I'm sorry, was that inappropriate? :) But seriously, the question is as follows: I set up an Entity using the XCode .xcdatamodel file editor. I created an entity called Person, added a few attributes, then generated a .m file to represent it. That all works fine. Now...

touches in cocos explanation

Hi guys I am new to objective C and iPhone game development. I am having some difficulty in understanding the code of to implement touches in cocos. Could anyone give me some explanation please? -(BOOL)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)events { UITouch *touch = [touches anyObject]; CGPoint location = [touch ...

Dynamically invoke a class method in Objective C

Suppose I have Objective C interface SomeClass which has a class method called someMethod: @interface SomeClass : NSObject { } + (id)someMethod; @end In some other interface I want to have a helper method that would dynamically invoke someMethod on a class like this: [someOtherObject invokeSelector:@selector(someMethod) forClass:...

bookmark a pdf programmatically in iphone app

Hello, i am new in the fraternity, I am developing a pdf reader. I am rendering pdf in a webview. Now I have to add bookmarks to this pdf like most of the other pdf readers which I have rendered. Can you suggest me how this can be done. Thnx in advance. ...

Help adding a backgroundView to UITableViewCell

I'm getting really desperate trying to add a UIImageView to UITableViewCell.backgroundView. All my efforts have resulted in this crappy rendering: It looks like the cell's label's white background is sitting on top of cell's background and covering portions of it. I tried setting the label's background color to clear, or some other c...

navigate to a specific page number of pdf document

Hello, I am developing a pdf reader, it reads large pdf files now I want to develop a system by which I can navigate among the pages of the documents. Can you suggest me some way of doing this. ...

Checking if a nsstring matches another string

Suppose I have a string "167282". How can I check if the string contains "128"? Is there any provision to know the percentage of the 2nd string that matches the first string? (If all the characters of the 2nd string are present in the first string or not.) Please help and thanx in advance. ...