objective-c

Reading from socket using SmallSockets makes my app crash

Hi, I'm creating an app using the SmallSockets library ( http://smallsockets.sourceforge.net/ ). I have this code: #import "MAController.h" #import "Socket.h" @implementation MAController - (IBAction)doRequest:(id)sender { //Initialize NSURL *uUrl = [[NSURL alloc] initWithString:[tfHost stringValue]]; int ...

Intercept method call in Objective-C

Can I intercept a method call in Objective-C? How? Edit: Mark Powell's answer gave me a partial solution, the -forwardInvocation method. But the documentation states that -forwardInvocation is only called when an object is sent a message for which it has no corresponding method. I'd like a method to be called under all circumstances, ev...

webview in core animation layer

I wanted to create a webView inside of a CALayer. Maybe it is too trivial but I am just getting my head into CA. Would anyone please be able to help? cheers Ron ...

Design pattern for Core Data iPhone App

Hi Im building an app that will use a Core Data model. I pretty new at Objective C and my usual design patterns does not really apply on Core Data and Objective C, at least I can't seem to find examples that confirms they will. I have been through the Apple Developer examples and different sources on the intertubes. It seems that to l...

Objective-C detect DNS

Does anyone knows how can i detect from an app the DNS of the iPhone? UPDATE: If there're different ways of obtaining the DNS server and DNS host name, any solution is acceptable. ...

IPhone SendDelegateMessage failed to return after waiting 10 Secs

Hi, I keep getting the following message from my iPhone 3.0 when trying to convert a large NSData object into base64Encoding for http transmission : void SendDelegateMessage(NSInvocation*): delegate failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode If you were not using the touch screen for this entire...

How do I incrementally rotate a UIImageView?

Hi, I need to rotate in image multiple times in 90 degrees I am using following code, CGAffineTransform transform = CGAffineTransformMakeRotation(PI/2); shape.transform = transform; here shape being my UIImageview. The problem is every time i click on rotate button it rotates it from its original position, which is not what I want...

alloc-init sometimes fails in program

I am bothered by the following code snippet in my program. If I write mo=[[myObj alloc] init]; it fails, but if I write mo=[myObj alloc]; mo=[mo init]; it works. These two methods are supposed to be equivalent but somehow I am messing up. Any light? Clarifications: myObj is the name of a class It fails by trying to allocate for...

How do you create an alias in Cocoa? Is a symlink good enough?

I couldn't find a convenient way to create an alias, so I went with a symlink. I'm worried that that might not be good enough. Maybe the icon doesn't show on some versions of OS X or something like that. [[NSFileManager defaultManager] createSymbolicLinkAtPath:aliasPath withDestinationPath:destPath error:nil]; Is this sort of thing th...

Possible circular reference problem

I am not an idiot, but header files make me feel like one sometimes. I have what is probably an overly-complicated set-up that has an error that I cannot resolve. Here it is in about as simple as detail as I can make it.... I have a Controller class that contains a Model class. I have a Scene class to capture actions and communicates ...

Objective-C uninitialized pointers vs null pointers

Maybe my memory has gone completely wacko, but I think I remember that declaring pointers without initializing them made them point to nil. But recently this doesn't seem to be the case. Has it always been this way? Or has it something to do with the compiler settings? ...

iTunes Connect API

Does iTunes Connect has an API? How do some applications download financial and sale reports to computer? Are there some C/Objective-C API wrappers? Thanks in advance. ...

Problem creating checklist (similar to TouchCells sample code) app for iPhone. Random cells get checked.

I've been having a problem creating a checklist in the style of the TouchCells example from the Apple sample code. Basically, it is a table that allows multiple selection of its items and gives each selected item a check mark. The problem I'm having is that when I select an item and then scroll down the screen, another item (off the scr...

How to link a framework for iPhone development using XCode?

I'm new to iPhone development and Xcode, so this might be really obvious. I have the exact same problem as referenced on this forum post I've created a simple list application, starting out with a custom datasource class that simply returns a hard-wired list of data. With that working, I'm now attempting to alter my dataso...

What's the best way to find if the processor type is PPC or Intel in Cocoa? (Do I have to use Carbon?)

I need to get it as a string to use elsewhere in the program, I'm not worried about compiler settings. I found HowToGetHardwareAndNetworkInfo on CocoaDev, but it seemed a little intense when all I wanted to know is PPC vs. Intel. ...

setPropertiesToFetch doesn't work as expected

I want a list of unique contacts that I've stored with core data. NSEntityDescription *entityDescription = [NSEntityDescription entityForName:@"Post" inManagedObjectContext:[self managedObjectContext]]; NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease]; [request setEntity:entityDescription]; ...

UINavigationBar background image via drawRect - issue with prompt animation

I'm adding a custom background image to my UINavigationBar by overriding the drawRect via a category. - ( void )drawRect:( CGRect )rect{ [[UIImage imageNamed:@"navbar.png"] drawInRect:CGRectMake( 0, self.frame.size.height-44, self.frame.size.width, 44 )]; } This solution seems to work fine, until you try to make use of navigatio...

How do I create many temporary objects and then save only one using Core Data?

I am working on an application that will perform a search against an online service and generate many Result objects. A Result object is an NSManagedObject, initialized as required by associating it with an NSManagedObjectContext. Users should be able to select a "Result" and save it as a "Favorite". In the application this is as simple...

NSDictionary keys sorted by value numerically?

I store names as keys and scores as values into an NSDictionary for saving in NSUserDefaults. I then want to get back the keys sorted by score, but I can't seem to sort them numerically, only by string. The result of 100, 50, 300, 200, 500 for example would be 100, 200, 300, 50, 500 Can this be done or do I need to go about this diffe...

Confused on const correctness with static array of pointers to const objects

I'm still not sure I totally get how this particular case should work out. So if I want to declare an array of NSStrings that won't change, is this correct? static NSString * const strings[] = {@"String 1", @"String 2", ...}; Is the static necessary? (what does it do?) Am I missing an extra const somewhere? There's just too many pl...