I know it's needed if your object will be used as a key in an NSDictionary. Are there any other times like this that NSCopying is required?
If I think I don't need my model objects to conform to NSCopying, am I probably wrong?
...
Hi all,
I want to add scripting support for an Objective-C project using the objc runtime. Now I face the problem, that I don't have a clue, how I should call an Objective-C method which takes several named arguments.
So for example the following objective-c call
[object foo:bar];
could be called from C with:
objc_msgSend(object, s...
I'm making a crash reporter, and I can read the crash reporter files just fine within ~/Library/Logs/CrashReporter.
However, I want to also send along with the report any console (NSLog) information that was printed to the console (the stuff that one can see both in Xcode and in Console.app). However, I want to make sure I get only the ...
What is best practice to stream multiple files in one ASIHTTPRequest?
Right now, for one file I use:
....
ASIHTTPRequest *request = [[ASIHTTPRequest alloc] initWithURL:someUrl];
[request setShouldStreamPostDataFromDisk:YES];
[request appendPostDataFromFile:someFilePath];
[request startSynchronous];
How to stream multiple files withou...
Hi: I wonder if there is any possibility to explicitly decode an incoming multipart/form-data POST request. Is there any lib to handle this safely? Several files are embedded in this request and I want to save these files individually.
NSData *data = [(id)CFHTTPMessageCopyBody(request) autorelease];
Content-Type: multipart/form-data; bo...
Another newbie question: What's the best way to store data in a Cocoa application written in Obj-C? For example if I want to create a sort of "quizzer" that quizzes the user with pre-written (and user-written) questions? How would I store these questions and answers? Core Data?
Thanks!
...
Hi All,
I want to download a file to the downloads folder. I searched google for this and found the NSURLDownload class. I've read the page in the dev center and created this code (with some copy and pasting) this code:
@implementation Downloader
@synthesize downloadResponse;
- (void)startDownloadingURL:(NSString*)downloadUrl destenat...
I am wondering if there is a way to do this using Core Animation. Specifically, I am adding a sub-layer to a layer-backed custom NSView and setting its delegate to another custom NSView. That class's drawInRect method draws a single CGPath:
- (void)drawInRect:(CGRect)rect inContext:(CGContextRef)context
{
CGContextSaveGState(context...
I have a threadMethod which shows in console robotMotorsStatus every 0.5 sec. But when I try to change robotMotorsStatus in changeRobotStatus method I receive an exception. Where I need to put locks in that program.
#import "AppController.h"
@implementation AppController
extern char *robotMotorsStatus;
- (IBAction)runThread:(id)sender...
I've got a int, that is changed in a previous method, that now has to be part of the name of a button variable. For example:
int numberFromLastOne;
numberFromLastOne = 4;
I then want to get 'button4' to do something.
Could I use something like this?
[[button@"%d", numberFromLastOne] doSomething:withSomethingElse];
I've never had t...
How can I get the on-screen location of a button in a toolbar? That is getting the rectangle frame of an NSToolbarItem? The [NSToolbarItem view] method seems to always return nil whenever the toolbar item is only a simple action button and thus I couldn't use the normal NSView methods to pinpoint the toolbar button's on-screen position...
I have a very simple requirement: I want to show a header and footer in print layout of a view. One approach I can use is to manipulate the height of the page and display some text fields at appropriate positions as header and footer, but I think there must be smarter way to do this in cocoa.
Can any one tell me- is there any default me...
After some searching, I got the following solution :
ref: http://stackoverflow.com/questions/1392909/nsmutablearray-addobject-with-mallocd-struct
CLLocationCoordinate2D* new_coordinate = malloc(sizeof(CLLocationCoordinate2D));
new_coordinate->latitude = latitude;
new_coordinate->longitude = longitude;
[points addObject:[NSData dataWithB...
Sorry if this is a repost but I couldn't quite search for it because I can't explain it in a few words. I have a super class with lots of methods but they will always (not all of them) be subclassed. From the super I need to run those methods. I could either leave the methods in super empty or I could just not type them in super but call...
I'm trying to get the notification NSTaskDidTerminateNotification in my multithreaded app but I can't get it working. It does seem to work when I tested it on a single threaded app. In init I have [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(taskDidEnd:) name: NSTaskDidTerminateNotification object: myTask];...
I’m starting to develop my first full-blown Cocoa application containing a view which I would like to behave (and look) similar to Automator’s AMWorkflowView.
The basic features I’d like to achieve:
Positioning of subviews
Display of subviews in expanded / collapsed states
Multiple selection
Drag and drop
In order to get accustomed...
Hi Guys,
recently I started a project which can export some precalculated Grafix/Audio to files, for after processing.
All I was doing is to put a new Window (with progressindicator and an Abort Button) in my main xib and opened it using the following code:
[NSApp beginSheet: REC_Sheet modalForWindow: MOTHER_WINDOW modalDelegate: self...
I am writing a Cocoa application that makes use of the ParseKit framework (http://www.parsekit.com/). I've included the Framework in the proper folder, added a Copy Files build phase, and added it to the build phase. I can build and launch the application on my Mac.
However, when I try to run it on another Mac, it crashes. The Console ...
Hi,
I'm new to Cocoa, but not to programming.
Recently I decided I wanted to write a FTP client for Mac, and so I first made it in the language I'm most comfortable in (on Windows), and then moved on to Cocoa when I had the workings of FTP communications down.
My question is (apparently) a bit controversial: How do I establish a read/w...
hi,
I am attempting to encrypt/decrypt a plain text file in my text editor. encrypting seems to work fine, but the decrypting does not work, the text comes up encrypted. I am certain i've decrypted the text using the word i encrypted it with - could someone look through the snippet below and help me out?
Thanks :)
Encrypting:
NSAlert...