objective-c

IBOutlet, use of member properties or not? memory leak ?

Hi I have noticed that the memory usage of a program I wrote, keep increasing over time. XCode's instruments shows no memory leak, yet you can see the heap stack growing over time.. Upon investigation, a lot of the memory usage come from the IBOutlet UI objects. The interface is build with Interface Builder. Typical usage would be lik...

Next item in Array to populate image view

Hey guys can someone help me please? I have a popover controller that is filled with an array (detailItem) and in different xib I load an image according to the current cell selected in detailitem. All I want is a button called nextItem which loads the next item in the array? Cheers -(IBAction) nextitem{ NSString * image...

GCD iOS 4 questions

Hi all, I've looked at some of the presentations form WWDC 2010 and also read most of the documents on blocks and concurrency and have a couple of questions regarding using blocks with serial queues in Grand Central Dispatch. I have an iOS 4 project that has a scrollview and a dictionary of image information - urls to the images and so ...

ImageIO causes more memory to be allocated than the size of the images

I have 5 UIimageViews which display .png files, each max 200kb, but ImageIO allocates around and average of 1.3 mb for each. totaling 7.3 mb for the view when loaded. What is causing this to happen? I have another class with same amount of images and that allocates only 2 mb max. ...

Recording and then Playing Audio using AVAudioRecorder and AVAudioPLayer

I have an AVAudioRecorder that captures the sound. What I want is to be able to Play(AVAudioPlayer) the recorded(AVAudioRecorder) sound as it is being recorded. I have set up the AVAudioSession property to playandRecord... but I dont know how do I program the following sort of scenario? Like you have your head phones on and you are wal...

Including a static library in a Xcode project

Hi, I have developed a static library using the "iPhone OS->Library->Cocoa Touch Static Library" of Xcode. I compiled it and it works fine. Then I wanted to include this library in a new project. Here is what I've done : Create a new Xcode project "View-based application" Project->Add To Project : I added my static library .xcodeproj...

Setting default application for given file extension on MacOSX from code

I have the list of the applications for given file extension (using LSCopyApplicationURLsForURL). I want to change the default file association from code upon selecting one of the applications from the above call. Is there a way to do this? Thanks! ...

Paging UIScrollView, changing content

Following the PageControl sample code on the Apple site here, i have created my application based on that. I have a grid of buttons, which need to change based on the current page. Where would be the best place to set up my array containing the buttons? In the -initWithPageNumber method or in -viewDidLoadof the view controller? In -view...

UIButton inside a view that has a UITapGestureRecognizer

I have view with a UITapGestureRecognizer. So when I tap on the view an other view appears above this view. This new view has three buttons. When I now press on one of these buttons I don't get the buttons action, I only get the tap gesture action. So I'm not able to use these buttons anymore. What can I do to get the events through to t...

Transfering data using Sockets on the iPhone using SSL/TLS

Hi, I've been asked to prototype an application which share information with a server via sockets using SSL/TLS. I've been asked to make the application in both C#(MonoTouch) and ObjectiveC(Cocoa). I've been successful with the MonoTouch route, and developed a fully working client server pair, which can communicate and share data secur...

Anyone know of a good csv to NSArray parser for objective-c

I'm looking for an easy to use csv parser for objective-c to use on the iphone? I'm also looking for other parsers such as json so maybe there is a conversion library somewhere. ...

iPhone basic memory management

Is this proper memory management? What I'm wondering is if I am supposed to release after the alloc in -viewDidLoad. SomeViewController.h #import <UIKit/UIKit.h> @interface SomeViewController : UIViewController { UIButton *someButton; NSString *someString; } @property (nonatomic, retain) IBOutlet UIButton *someButton; @prope...

How can I use the facebook connect api for the iphone to to invite friends to an application or send a message.

In my iPhone application, I wanted to add the function of signing into Facebook and letting a friend know about the app. I know how to sign in and get the friends list, but I cannot find a good way of inviting a friend. So far, I haven't been able to come up with a way to invite a friend (I don't think one can with the iphone facebook sd...

iPhone memory leak monitoring when not hooked up to a computer

I have an application that needs to be unplugged from the computer to use (it is interfacing with a device through the port) so I don't think using Instruments will work. Is there any way to monitor memory allocations/leaks without the iPhone being attached to the computer? Thanks. ...

Sorting/Shuffling an NSMutuable Array

Hi, Im just starting getting into Objective-C, i'm trying to sort an array so it is as low discrepancy as possible. int main() { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSMutableArray *myColors; myColors = [NSMutableArray arrayWithObjects: @"Red", @"Red",@"Red", @"Red", @"Red", @"Green", @"Green", @"Gr...

Can i use Base SDK 4.0 for iPad only app?

We are developing an iPad app for which I am trying to use sharekit http://getsharekit.com I am getting this error if I use the Base SDK 3.2 Cannot find protocol declaration for NSXMLParserDelegate But if I change Base SDK to 4.0 it works fine. I think its possible to use Base SDK 4.0 when creating Universal apps. Does anyone kno...

Method not found in protocol: Objective C

I have this in my view controller: [[[UIApplication sharedApplication] delegate] sendMessageAsSingleObject:[sender currentTitle]]; Which gives me this warning: warning: '-sendMessageAsSingleObject:' not found in protocol(s) But in my AppDelegate i have the method declared in the header... I should add that the call works, just wan...

Only displaying managed objects depending on an attribute

This is probably very basic but I am struggling. I have an NSFetchedResultsController that gets managed objects from an entity I specify. The problem is I want to only display the managed objects that have a certain attribute in my table view. - (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath { NSManaged...

Emulating the camera apps 'tap to focus'

I am trying hard to emulate the basic functionality of the built in camera app. Thus far I have become stuck on the 'tap to focus' feature. I have a UIView from which I am collecting UITouch events when a single finger is tapped on the UIView. This following method is called but the camera focus & the exposure are unchanged. -(void)han...

Confounding Cocoa problem — program hangs unless there’s an unrecognised method call.

Bear with me, this one is hard to explain. I hope some hero out there knows what’s going on here. Some history needed; One of my cocoa objects, “Ball” represents a small graphic. It only makes sense within a view. In some of the Ball’s methods, it asks the view to redraw. Most importantly, it asks the view to redraw whenever the Ball’s ...