objective-c

Easiest way to post to a server on iPhone? I don't care about the response.

I've looked at some of the apple core API stuff, as well as ASIHTTPRequest. It's made me curious - is there a simple way to just send a nonblocking request to a URL? I could do it what seems to be the standard way - make the request object, make a useless delegate object that just ignores the response, and that's how I've been doing it. ...

Base64 Encode File Using NSData Chunks

Update 4 Per Greg's suggestion I've created one pair of image/text that shows the output from a 37k image to base64 encoded, using 100k chunks. Since the file is only 37k it's safe to say the loop only iterated once, so nothing was appended. The other pair shows the output from the same 37k image to base64 encoded, using 10k chunks. Sinc...

Calculate cell height based on number of lines?

I'd like to make a custom UITableViewCell height using (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath. I'm trying to get the height of the UITableViewCell by multiplying the number of lines in textLabel by the height of each line and then adding 10.0f for the subtitle. I am using the follow...

Check UITextField for keystrokes when they happen, driving me crazy :-)

I am very new to this and i am sorry to ask this question. I am trying to get this to work for my code but just don't get it. Whatever i seems to do the key that i press show up in the NSLog one key stroke after. I know that the 'shouldChangeCharactersInRange' works this way and i have surfed and tried to test some solutions i have foun...

When to release. Instruments says I have a leak.

Sometimes I wonder where I would be able to get great information other than from the stack overflow community. I suppose the Objective-C memory management handbook wouldn't be bad, but I feel like you guys can tell me why as opposed to just what to do. I have the following code: NSString* rawTickerData = [[NSString alloc] initWithData...

Linker Error in Objective-C static library with unit testing

In my Cocoa Touch static library project, I have a target set apart for unit testing with OCUnit. When I build the project, I have several unit tests that are supposed to automatically run, but when I actually build the project, I get this linker errors: "_OBJC_CLASS_$_ObjectIntTreeMap_ObjectEntry", referenced from: objc-class-ref-to-Ob...

NSRange freezing app

NSString *originalString = entriesResultStr; NSRange jarvisRange = [originalString rangeOfString:@"favoriteCount"]; NSString* substring = [originalString substringToIndex:jarvisRange.location]; For some reason, when I use NSRange, my app window won't open, but when I comment it out, my app opens fine. Any ideas? ...

How do I automatically activate an item in the OS X Services Menu

I need to have a service I created enabled by default in the services menu. I've created a service for my OS X app (running on Snow Leopard). I've configured the Info.plist like so: <key>NSServices</key> <array> <dict> <key>NSSendTypes</key> <array> <string>NSStringPboardType</string> </array> ...

issue with positioning of pop over view.

Hi, When I am switching between Portrait to Landscape view (&Vice Versa) in iPad, position of my popover view gets garbled. Here is how I am calculating frame of my popover view: aRect = self.myElement.frame; aRect.origin.x += aRect.size.width; [aPopOver presentPopoverFromRect:aRect inView:self.myElement.superview permittedArrowDirecti...

How can I flip a CALayer with CATransform3D?

Looking for help on how to have a CALayer flip like a UIView using CATransform3D. I have seen some articles but I'm having a hard time understanding the 4D and 3D coordinates system, model and references. I also read apple's documentation, but I'm not understanding it either. My goal is to flip a card located within a layer within a v...

iOS: can I use one timer to trigger multiple things at certain times?

I need a button to do different things depending on how far along the person is in watching a video. So for instance at 0-20 seconds it does thing A then at 20-25 it does thing B and 25-32 thing C Can I make a timer that counts up and fires different messages off at specific intervals to enable/disable my buttons or change what they d...

NSView subviews and types

I have a couple of custom NSBox subclasses called OuterBox and InnerBox. I've set up my view in a XIB and arranged the hierarchy like this: OuterBox : NSBox NSButton NSBox InnerBox : NSBox ...and some other views The idea is that when the NSButton gets pressed, in an IBAction method, I want to get the superview of the ...

Get ppi of iPhone / iPad / iPod Touch at runtime

Anyone know if there's a way to get the screen density (ppi) of the device at runtime? It'd be nice to not have to hard code the different densities in case apple switches it up in the future... ...

UIImagePickerController - Setting a maximum video duration

Hi, I am using the following code to allow users to record video using their iPhone camera, and then upload it directly to my server. I would like to put a limit on the length of the video they can record (5 seconds in this example) and it looks like using videoMaximumDuration would be the obvious way of doing that, but it has no effect...

Getting possible dictionary key names?

How can I tell what options I have for objectForKey: calls? How do I know what values are non-null for the 'forKey' portion of the message? ...

iphone sdk MapView update users location

Hi guys, I've successfully put together a mapview with a pin annotation representing the users current position that updates at a set interval. When the location manager updates the user's position, the pin annotation disappears and reappears at the new location. Has anyone played with getting the current user's GPS location to update th...

Is it possible to detect the current keyboard input method on the iPhone?

I want to know the current input method the user is typing in such as En (english), German, Chinese, etc... Maybe keyboard type is what I am after, but documentation seems limited on this subject from Apple doc. Thank you! Managing the iPhone Keyboard http://developer.apple.com/library/ios/#documentation/StringsTextFonts/Conceptual/...

ViewController not responding to didRotateFromInterfaceOrientation

Hi, My view controller is not responding to didRotateFromInterfaceOrientation, despite that I have added following in my code: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { [self...

What to use if not "IPHONE UDID"?

Wow... look at all the "panic stories" online this week regarding using an iPhone's UDID. [[UIDevice currentDevice] uniqueIdentifier] What SHOULD we be using instead? What if the phone is sold to another user... and an app has stored some data on a remote server, based on the phone's UDID? (Of course, I want to avoid the problems w...

IPhone: Should I use 'instruments' to verify memory leaks?

I've just kind of been 'winging' it with long tests (for hours) with no crashes, and eyeballing my code for quite a while and made sure that everything looks pretty kosher as far as memory leaks. But should I be using instruments... is it mandatory to do this before uploading to app store? ...