Following is Objective-C code where I'm trying to do a compare between two NSString values, however it throws a runtime error. Here's the code:
NSDictionary *innerContent=[JSONResponseDict valueForKey:@"JSONRESPONSE"];
NSString *authFlag = [innerContent valueForKey:@"authenticationFlag"];
NSLog(@"authFlag = %@",authFlag);
UIAlertView ...
Maybe this is obvious, but I don't know how to declare class properties in Objective-C.
I need to cache per-class a dictionary and wonder how put it in the class.
...
Suppose I have a class like this:
@interface SomeClass : NSObject<NSCopying> {
SomeOtherClass *obj;
}
In the definition of copyWithZone:, I do this:
SomeClass *someCopy = [[SomeClass allocWithZone:zone] init];
So my question is, if I want to make a copy of obj, which of these is correct/recommended?
option A:
objCopy = [obj c...
I am developing an iPhone application using Objective-C. I want to access a data member which is of type NSMutableArray of the RootViewController class in another class. I tried making the array static. But I would like to have a non static array. How do I achieve this?
...
Hello
I have this little code
NSMutableArray *myArray = [[NSMutableArray alloc] init];
NSNumber *myNumber = [NSNumber numberWithDouble:752.65];
[myArray addObject:myNumber];
With this code I store Objects inside an array. But now I have two objects independent from each other.
If I change myNumber after it's been added to the a...
I'm writing an iPhone application that needs to get some data from a web server. I'm using NSURLConnection to do the HTTP request, which works well, but I'm having trouble unit testing my code in the case where the response has an HTTP error code (like 404 or 500).
I'm using GTM for unit testing and OCMock for mocking.
When the server ...
I have a class called GameScene, with is a subclass of a cocos2d Scene.
In there I have two layers. GameLayer and ControlsLayer. You can probably tell already that I want the ControlsLayer to move stuff around in the GameLayer. To be precise, I'm trying to control a cPBody in the GameLayer from the ControlsLayer.
At the moment, I'm t...
I'm trying to learn Objective C & Cocoa, but I just can't manage to access a property inside an Object. Specifically an object from a C method. I'm working with the chipmunk dynamics library.
Chipmunk has something similar to NSPoint called cpVect. Now I have no problem defining a cpVect inside my object, but when I try to make the acc...
Hi,
I'm wondering if there is some image manipulation library that will allow me to take two images and blend them together. Or blend together parts of images in a mosaic so that it doesn't look like its a mosaic, but is one whole image.
I've looked on google code and searched for such a library, but couldn't find anything.
Thanks!...
Hi, I have written an cocoa application to take a picture on the iPhone. I need to transfer the images taken to somewhere besides the iPhone namely another server. Does anyone know how I can accomplish this?
Thanks,
Joe
...
What is an easy way to time a Cocoa application? (Alternatively, any good way to measure performance would suffice).
(I have two different frameworks and would like to compare their performances over some fixed input data)
...
I am creating an iPhone app which I would like to have a similar interface to the iPhone's native contact picker view, i.e. an alphabetical list which you can scroll through, with a search bar up top which narrows down the list. Particularly, I'd like to be able to show the letters of the alphabet down the side so that as you scroll thro...
I am happily able to set the styling of my tableviewcells using the cellForRowAtIndexPath delegate, but I want to set the background of all the nonpopulated cells which are still on the screen
...
I'm the author of GitX. One of the features GitX has is the visualization of branches, as can be seen here.
This visualization is currently done by reading commits which are emitted from git in the correct order. For each commit the parents are known, so it's fairly easy to build up the lanes in the correct way.
I'd like to speed up th...
Hey guys, I am making a simple Twitter update application using MGTwitterEngine
and I can't seem to get the TextField in Interface Builder to clear the text after they click the "update" button. Is there an easy method that I could do this with or something in Interface Builder?
Thanks a lot!
...
Hi, I am programming with objective c and I want to get character's alphabetical order. For example:
A, a - 1,
B, b - 2,
...
Z, z - 26
Is there a function in Objective C that enables me to achieve this goal?
Thank you in advance,
Ilya.
...
Hi, I'm trying to format large currency numbers like this:
NSNumber *testVal = [NSDecimalNumber decimalNumberWithString: @"999999999999999993.00"];
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[formatter setMaximumIntegerDigits:19];
[formatter setMaximumFract...
Concatenating strings and ints seems like a real chore in Objective C. I'm new to the language, so can someone help me with a sort of general purpose function that I can plug into my project and simplify this and not require a lot of typing (where other languages could just use a +)?
Thanks very much!
...
I want to send a UIImage to a server through a socket.
a)I open the outputstream:
- (IBAction)send:(id)sender {
NSURL *website = [NSURL URLWithString:str_IP];
NSHost *host = [NSHost hostWithName:[website host]];
[NSStream getStreamsToHost:host port:1100 inputStream:nil outputStream:
[oStream retain];
[oStream setDe...
I have no Objective-C experience whatsoever but have a strong C++ background. Is there an automated tool/script or, worst case, some manual method using some excellent reference to port code written in Objective-C to C++? What are the difficulties involved?
Edit:
I'm told the code uses Objective-C fairly trivially. It's an iPhone app th...