I use this code to process a date string coming in from a json feed:
NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
[formatter setDateStyle: NSDateFormatterLongStyle];
[formatter setFormatterBehavior: NSDateFormatterBehavior10_4];
[formatter setDateFormat: @"EEE, dd MMM yyyy HH:mm:ss +0000"];
so if I call
NSDate *date ...
I could use a clean, working, base64 implementation for the purpose of authorization over HTTP for a REST protocol.
Can anybody help me out or point me in a direction?
Thanks.
...
Is there a way to compare two Objective-C objects based purely on the protocol they implement.
Specifically I'm looking at comparing two objects conforming to MKAnnotation (iPhone mapkit annotations). Given two objects that conform to the protocol, I would like to determine if they are equal as far as the protocol is concerned. In this ...
Hi,
I have a view with a back button managed with a navigation controller and I want to check if a file has been saved when the user click on the back button.
If the file has been saved you go back in the previous view, else a uialertview ask you if you want to save the file or not.
So I did that but the view disapear and the alertview...
NSArray *splitPoints = [routeGeom componentsSeparatedByString:@"], ["];
routePoints = malloc(sizeof(CLLocationCoordinate2D) * ([splitPoints count] + 1));
int i=0;
NSArray *coords;
for (NSString* coordStr in splitPoints) {
coords = [coordStr componentsSeparatedByString:@","];
routePoints[i].latitude = [[[coords objectAtIndex:0] su...
What's the proper way to tell if an object is allocated in Objective-C?
I've seen in sample code (and this seems to work only if it's never been allocated):
if(!Object) { ... }
I've also tried setting Object = nil, but that's a tedious process each time, gets a little bit annoying.
But if I have an object, and I want to allocate ...
Thanks to the respondents on this question (http://stackoverflow.com/questions/1396949/this-loop-is-very-slow-i-think-because-i-create-a-lot-of-intermediate-strings-h) I was able to speed up my code many orders of magnitude.
I think I can probably do a bit better though. Is it possible to avoid the creation of a bunch of NSString's here...
I have setup a connection to a server and now I want to transfer images to the iPhone. What's the best way to do this? I checked here and I don't see a way to transfer anything other than xml. I need images. Thank You!
...
I have a custom NSCell with various elements inside of it (images, various text pieces) and one of those text blocks may have various clickable links inside of it. I have my NSAttributedString correctly identifying the links and coloring them blue however I can't figure out how to get the cursor to turn into a hand and allow a user to ac...
//obj C version, with some - less than one second on 18,000 iterations
for (NSString* coordStr in splitPoints) {
char *buf = [coordStr UTF8String];
sscanf(buf, "%f,%f,", &routePoints[i].latitude, &routePoints[i].longitude);
i++;
}
//C version - over 13 seconds on 18,000 iterations
for (i = 0; buf != NULL; buf = strchr(buf,'[...
I have three button named(titled) hello, nothing, heaven and one label (IBOutlet UIlabel lab). I want to display three diff messages for three diff button click. But the following code failed to accomplish this. Can anyone suggest any idea?
-(IBAction)buttonclick:(id)sender
{
NSString *title=[sender titleForState:UIControlState...
Hi guys, I have a variable declared like this in a class:
Entity *array[BOARD_SIZE][BOARD_SIZE];
I need to set up either a @property that allows me to access (read) the array elements, or a function that returns a reference so I can access the array elements.
- ( ??? ) getEntityArray
{
return ???;
}
or
@property (????) Entity ...
SendDelegateMessage: delegate failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode
If you were not using the touch screen for this entire interval (which can prolong this wait), please file a bug.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
/*
...
What is the difference in accessing an objects properties or methods via foo.property to [foo property]?
...
Hi all,
In the calender app in the iphone, when you click in the starts/end cell, the picker is already fill with data with no delay?
How?
...
I am trying to count the total songs from the ipod library. Due to grouping any songs with same title will not be added to the array.
MPMediaQuery *songsQuery = [[MPMediaQuery alloc] init];
NSArray *mySongs = [songsQuery collections];
NSLog(@"%d", [mySongs count]);
Is there an alternative/better way? Any ideas welcome.
...
Hi,
I am trying to make an application on mac.i am trying to develop a user authentication module that uses the OS authorization dialog and use its functionality in my application. i have two questions regarding the mac development;
1) Is there a possibility to port the carbon applications to cocoa? (i don't have any concern
with ...
I need to add a few methods to an already identified class in a closed source application. Using f-script anwywhere and gdb I know what I need to interact with to acheive my goals.
However I am struggling to find a solution to allow me to inject some code (preferably objective-c) into the running application.
For the time being I wo...
In the dealloc method for a class how would I print out the ID (or some other unique identifier) for the instance being deallocated?
- (void)dealloc {
NSLog(@"_deallocing: ??");
[super dealloc];
}
Is this possible? I am just trying to get a little more feedback in the console as an aid to learning.
many thanks -gary-
...
The default description for a class instance returns "ClassName: 0x105120". How might I modify the method below to just return the "ClassName"?
// The code below just returns the address ...
- (NSString *)description {
NSString *result;
result = [NSString stringWithFormat:@"%p", self];
return result;
}
EDIT: in that case woul...