objective-c

Sharing classes between projects in xcode/objective-c

Hey folks, I've got a client<=>server app I'm building for Mac OS X, using Objective-c/Cocoa and xCode. I've created a different project for both the apps I have, and I'm wondering the best way to share classes between them. There are several classes I've made that would be useful to both. This far I've been copying them around, but I f...

XCode + svn tips, tricks, etc

Hi, I'm curious to know your tips and tricks using XCode and Subversion. Not necessarily only focused on actions that can be done to a svn repo from xcode itself - but what things have you done to make your life easier when working with a svn managed folder that contains an xcode project? What files did you ignore? Any custom built scrip...

iPhone Application crashes in "AdHoc" mode

Hi guys, i got a little application which is working very well with my "debug" configuration on my phone and in simulator. i created a adhoc provisioning profile, and added a "beta" configuration to it. trying to launch the application with the ad-hoc configuration crashes my application immediatelly. the console output is: Running…...

Synthesize a BOOL to set value in Objective C

I have created a BOOL attribute in my Core Data entity called "useSystem". Additionally in order for me to get/set the data I have created an object, however whenever I try to set the synthesized BOOL I get a bus error. This is my code: @property (nonatomic) const BOOL useSystem; So I'm doing [object setUseSystem:YES]; And immediat...

What kind of data type is "long long"?

I don't know this type. Is that the biggest one from all? I think it is an integer type, right? Or is it a floating point thing? Bigger than double? ...

Justifying UIVIews on the iPhone: Algorithm Help

I have been messing around with a way to justify align a collection of UIView subclasses within a containing view. I am having a little bit of trouble with the algorithm and was hoping someone could help spot my errors. Here is pseudocode of where I am now: // 1 see how many items there are int count = [items count]; // 2 figure out ...

OpenGL ES Light Question

Hello, I am new to OpenGL ES and are developing in Objective-C for iPhone. What I am trying to understand is how light is positioned in my frustum. This is how I do it: I create a square and put it as "floor" in my frustum. I am putting the light, right above, in the middle of the floor and point the direction of the light right dow...

Switching Views within UITabBar View

Hello, I have created an UITabView application. Each view selected from the bar is a seperate controller with own nib file. I switch between them succesfully. In the first view I have two buttons (check out the screenshot). When clicking them I want to switch to another views which are the parts of the current view controller. I use: ...

How do I send key events to a Flash movie in WebKit?

I am trying to create a site-specific browser application. I've created a new Cocoa app, added a WebView to my window, and am loading up the page. The page contains a Flash movie, which can be controlled via the keyboard. I'd like to wire up some menu commands to trigger the actions, presumably by simulating the keystrokes. I've travers...

Adding UITableViewControllers tableview to new UIView

Hi, I have a simple question. I have a normal UITableViewController displaying a UITableView. When the user taps a button in the top right corner of my application I want the TableView to flip from right to left and then display a new UIView. I've found the animation UIViewAnimationTransitionFlipFromRight which flips the current view an...

Implementing "add photo" button similar to the iPhone contacts app

I was curious if anybody knew the process to create an "add photo" image tile similar to that in the iPhone contacts app. It seems to be on the same level as a UITableViewCell which is shortened (if this is the way it is done). I've read a suggestion dealing with Headers or custom UITableViewCells but nothing definitive on how it was do...

What's the correct way to perform initialization code whether an object is loaded from a nib or created programmatically?

I've noticed that if you load connected views from a nib you have to override initWithCoder if you want to add initialization code because the designated initializer doesn't get called (which does make sense), and if you don't load the view from a nib then the same code needs to be executed in the designated initializer. So in order to ...

Reusing NSMutableArray

I'm getting some leaks (obvserved by Instruments) when trying to reuse an existing NSMutableArray (in order to save memory). Basically I'm creating an NSMutableArray, filling it with objects (UIImages) and passing it onto another object which retains it. However, I now need to use an NSMutableArray again. I figured I would release all ...

How access to response http headers from 'didReceiveAuthenticationChallenge' delegate method

Hi all, I need to deal with an http authentication (401) using the NSURLConnection class, so I implemented the "connection:didReceiveAuthenticationChallenge:" delegate method. In this method, to respond to the server challenge, I need an information contained in the http server response headers (the WWW-Authenticate header one). My pr...

got EXC_BAD_ACCESS when I Cancel a Asynchronous web request by using ASIHTTPRequest

I have no problem to run the sample code below in a iPhone simulator, but when I run it in a iPhone , I always get a EXC_BAD_ACCESS when I call [asiRequest cancel]. anyone can help? thanks. ASIHTTPRequest *asiRequest; -(IBAction)request1{ NSLog(@"request starting"); [self sendRequest]; } -(IBAction)cancel1{ NSLog(@"request...

Core Data: An Inverse Relationship to multiple entities?

Let's say I have 4 entities in my data model: Person, Car, Pet, and Photo. I would like a relationship from Person Car and Pet to the Photo entity, in that I'd like each of those things to contain a photo of that item. So far, no problems. Though where it gets tricky is the inverse relationship, which is where the photo entity would want...

iPhone / Objective C: How to log a methods execution time exactly in milliseconds?

Is there any way to determine how long a method needs for execution? In seconds would be not accurately enough - in milliseconds would be better. ...

NSDateComponents returning strange hour

I'm writing some code to acquire images that live on a server. The image filenames are in yyyyMMdd_HHmm format (in UTC) and generated every 3 hours (1200,1500,1800,..etc). When the code starts, I get the current UTC date and extract the time. I then create an NSDateComponent from this, and looking at the current time, set the hour of the...

Showing value of UISlider inside App Prefs?

I have a settings bundle, working perfectly, that I would like to customize a bit. I have, among other things, a PSSliderSpecifier and a PSTitleValueSpecifier. What I would like to do is change the value of the PSTitleValueSpecifier to show the current value of the slider, preferably updating every time the slider's value changes (Act...

Use of nested references in objective C

Getting an error message "Nested functions are disabled, use -fnested" etc in XCode/ObjC. Here's the code (balls is an NSMutableArray pointing at a bunch of UIViews). CGPoint pos=[[self.balls objectAtIndex:pointidx] center]; But the following seems to compile ok. UIView *ref=[self.balls objectAtIndex:pointidx]; CGPoint pos=ref.cent...