iphone

How do I fix Cocoa error 513?

I have an iPhone application in which a number of domain objects are populated with user-entered data. In order to restore state after being interrupted, these objects implement the NSCoding protocol and are written to disk (the Documents directory) in the applicationWillTerminate message. Then, when the application is launched again, th...

Disclosure Indicator disappears?

I have a UITableView which is using custom UITableViewCells to display some information. I'd like to add a UITableViewCellAccessoryDisclosureIndicator to the cells. Every method that I try successfully adds the chevron, but once the table view scrolls down, they disappear. I'm doing the standard dequeueReusableCellWithIdentifier method, ...

iPhone SDK: NSString-to-C-char-array crashes on second invoke to drawRect

I could not find a post exactly like this, so please forgive me if this is a duplicate. I am trying to write text using a Core Graphics context. I can do it the first time, no problem, but the second time crashes my iPhone app. Here is a code snippet: NSString *name = [MyClass getName]; const char *cname = [name UTF8String]; [self dr...

Programatically show the keyboard on iPhone app

I have a view with only one UITextView that is used to enter a value. I want that when the view shows, the textview becomes the first responder (that's the easy part) and also the default keyboard shows up. I tried searching for this in speca but to no avail. There are many posts on how to dismiss the keyboard, but what I want is to show...

iPhone: Tracking/Identifying individual touches

I have a quick question regarding tracking touches on the iPhone and I seem to not be able to come to a conclusion on this, so any suggestions / ideas are greatly appreciated: I want to be able to track and identify touches on the iphone, ie. basically every touch has a starting position and a current/moved position. Touches are stored ...

Layout screws up when I push several controllers without animation

So I have a stack of three UITableViewControllers, each of which displays its view correctly underneath the navigation bar when I tap through the UI manually. However, now I'm working on restoring state across app restart, and so I'm pushing the same two controllers on top of the root view controller, one at a time, in the same method i...

iPhone static library distribution and release build errors (but not for debug)

Update Daniel was close, it just wasn't the search path. The Prefix Header under GCC 4.2 was set to: $(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h I missed that when I was combing through the first 2 times. I removed it and now all is well. Original Question I have been using/building products with a static lib...

Iphone Game Development

What are people using mostly to build iPhone games with? I'm learning iPhone programming. Currently I'm watching all the stanford vidcast, doing the assigments and going through the beginning iphone development apress book. I want to get into building games and want to know if developers are buidling everything with opengl es or are they...

In Xcode What does it mean when a linked static library turns red when switching build configurations?

I think the title is pretty clear. I have ran into this twice now. The first time it indicated a problem, and my project wouldn't compile. The second time everything still worked. Is it just a fluke if my code still builds when this turns red? ...

Best way to organize a complex iPhone project file structure?

When working on an iPhone project, it can get really messy and many files are created (libraries, view controllers, interfaces...) What's the best way to organize your project files? What group structure do you use? Should I follow the MVC paradigm into groups? Thanks! ...

iPhone SDK: How do you measure the width and height of a string using Quartz?

Before I ask my questions, this is from Apple's documentation re: how to determine the width of a string using Quartz: If text measurements are important to your application, it is possible to calculate them using Quartz 2D functions. However, you might first consider using ATSUI, whose strength is in text layout and measurement. ATSU...

Finding the closest point to a given point

Hello- I have searched all over for this, but I can't seem to find the best approach to this. I have about 22000 lat/lon points and I want to find the closest one's to the current location of the iPhone. I've seen people ask about Quad Trees, Dijkstra's Algorithm, and spatial databases. Which is the best for the iPhone? Spatial databases...

how iphone app Battery Log works?

I did some research and found that there is a log in the /private/var/ in which we can get the battery log. But unfortunately the iphone apps doesn't have read access to that file. So I was wondering how the "Battery Log" works? (Battery Log is a app in the app store. It can display the battery history usage) ...

UIViewController -viewDidLoad not being called.

As a Cocoa noob, I'm having a few issues with Interface Builder, UIViewController and friends. I have a UIViewController subclass with a UIView defined in a xib, and with the controller's view outlet connected to the view. The xib's "file's owner" is set as my controller subclass. In this one instance, the following code to load the co...

Can not set UISwitch outside of controller class

The iphone program is set up in the Utility Application model where you have a root view and two subviews (mainViewController & flipsideViewController) which are outlets. If I try to set the UISwitch at rootViewController's viewDidLoad (with [flipsideViewController.switchInstance setOn:YES]), it doesn't work. Within flipsideViewCon...

exc_bad_access, but with no zombies, and not in debug build configuration--HELP!

This is driving me nuts. I just uploaded my first app to the App Store for the first time, and of course, now my app is exploding left and right. When I build with release build configuration, I randomly get an EXC_BAD_ACCESS after banging on the app for some variable amount of time. I turned Zombies back on, but the problem doesn't appe...

UITableViewCell action badge

Does anyone know how to implement an action badge, like the ones seen below with the price tags in them. The App Store has those too. ...

What's the difference between frame and layout in Interface builder's size inspector?

In IB, there is a dropdown in Size Inspector showing "Layout" and "Frame". I know what a frame is, but I don't know what the layout is in this case. What is the difference? ...

iPhone: Locking UIImageView while moving

Hello, I move a UIImageView with touchesbegan, touchesmoved, touchesended. It works well, but is the touches get also applied to other UIImageViews, laying around. How do I lock touching activity while moving the UIImageView? I've tried this with a Boolean Value, but it hasn't worked, because touchesmoved get called every time the UIIm...

Audio Recording iPhone - values of AudioStreamBasicDescription

These are the values I pass in, it's the only combination of values I have got working. dataFormat.mSampleRate = 44100; dataFormat.mFormatID = kAudioFormatLinearPCM; dataFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsBigEndian; dataFormat.mBytesPerPacket = 4; dataFormat.mFramesPerPacket = 1; dataForma...