objective-c

Check if user has a song from iTunes in his library

Hi, I am building an iPhone app for music album released on iTunes, client requested that if user purchased the album, the app should allow to play these songs in the app while playing games. I need to find a way how to quicly check if the song is available in the iPod library. I've heard that every song from iTunes has some unique ID b...

Getting CFMutableDictionaryRef Values

Hello Everyone, I would like to access some values from a CFMutableDictionaryRef and then do some math on them. Using the code below I have managed to print some properties of my battery. I am also able to print out single values (although in doing so I get a warning:invalid receiver type:CFMutableDictionaryRef). Then I try to convert...

how to connect to remote database from iPhone application?

I want to connect to a mySQL database from my iPhone application. How should I do this? ...

How to exchange data between Objective-C and PHP

I am playing around with Objective-C and have been looking for a good how-to example to exchange data it and PHP. JSON? SOAP? If anyone knows of a well written example I could hack at, I would appreciate it. ...

Using CAGradientLayer as backround while also drawing in context with drawRect:

Hi all, I'm writing an app that plots some data into a simple graph and sometimes want to draw out the scale in the background. To do this I have a UIView subclass which acts as the graph background and simply use the drawRect: method to draw the scale (data elements will get added as subviews to this view, since I want the user to be a...

How to get a list of all running processes on a Mac?

It would all be good to get: The process ID of each one How much CPU time gets used by the process and can we do this for Mac in C or Objective C? Some example code would be awesome! ...

Encoding images to video with ffmpeg

Hi. I am trying to encode series of images to one video file. I am using code from api-example.c, its works, but it gives me weird green colors in video. I know, I need to convert my RGB images to YUV, I found some solution, but its doesn't works, the colors is not green but very strange, so thats the code: // Register all formats a...

How to use CTTypesetterSuggestClusterBreak in CoreText + objective C

Hi all, I am having trouble in using CTTypesetterSuggestClusterBreak function of CTTypeSetterRef class. I want to use this method to get closest word boundry near an index. I am having difficult in the implementationof this method, i.e how and where this method must be used. I have been banging my head over this but with no success yet....

Problem with Thread and NSTimer

Hi I have a problem in my code. I want to launch the thread but when it is launched they can't start a NSTimer istruction. Can you help me? -(void)detectionMove:(NSTimer*)timer{ int indexArray = [[[timer userInfo] objectForKey:@"arrayIndex"] intValue]; // do something } -(void)callDectectionMove:(NSNumber*)arrayIndex{ ...

Should I release self.view?

Hi everyone, I have a question regarding to self.view in a UIViewController. First, in my app, everything is created programmatically. And normally I create self.view in the loadView method: self.view = [[UIView alloc]initWithFrame:SCREEN_FRAME]autorelease]; // SCREEN_FRAME is a constant At this moment, the retain count of self.view ...

How to retain value in UITextfield

I am implementing Text to Speech for Iphone, and successfully implemented it, but how to retain value in text field when second time I re-open my application. I want to read the text from where I left. So is NSUserdefault is good approach? But what if when i using a file instead of textbox and want to start reading from same place where...

free vs. dealloc vs. release

Hi guys, I am very new to obective C and Ipad app development. Can someone explain the difference between "free", "release", "autorelease" and "dealloc"? Thank you so much in advance. I realise this might be a simple question for the pros but I genuinely don't know where to use what. Thank you ...

objective-c memory management

Let's say I have an object that has other objects in it. For example an NSMutableArray object "list" that has a few other objects. If I no longer use any of them, can I just type [list release]? Or do I have to release the objects in the list 1 by 1? ie. for (int i=0; i < [list count]; i++) [[list objectAtIndex(i)] release]; If...

How to make a cell in a grouped tableview a button for the iphone

Currently I have a grouped tableview with four different custom cells. My last cell needs to be a button but I'm not sure how to implement this correctly. My code is below: cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; UIButton *btn = [UIButton button...

Converting signal to NSException only work the first time

It seems that when BSD signals are converted to thrown exceptions, it only work the first time but not subsequent times. I tried to convert signals to exception via the following call I made in the main method just before calling NSApplicationMain : [[NSExceptionHandler defaultExceptionHandler] setExceptionHandlingMask:NSHandleUncaught...

I would like to make UIView animation like Mac genie minimize effect

Hi, I have 2 UIViews and I would like them to replace places in the main view in animation like the mac or a better example is in iMovie, the way how the two windows replacing places. Thanks! ...

Objective C memory problem

Hi all, I have 2 scenarios and I want to know which way is correct and better? -(Employee*) getCustomEmployee{ Employee *emp = [[Employee alloc]init]; // no autorelease here //do something with emp return emp; } -(void) process{ Employee *emp = [self getCustomEmployee]; //do something with emp [emp release]; //rel...

Objective-C : Properties question

As far as I understand when you use properties the compiler still converts them to accessor methods during compilation. I got a little irritated when I read you need OSX 10.5 or later to use properties. Why is that so? If in the compiled application are in fact still accessor methods I see no need for OSX 10.5. Or is there something els...

Objective C memory leak

Hi all, I want to clarify whether there is a memory leak in this code? As far as I feel its there. in .h file @interface MyClass{ NSMutableArray *dataArray; } @property(nonatomic,retain) NSMutableArray *dataArray; in .m file -(id) init{ self. dataArray = [[NSMutableArray alloc]init]; } -(void) dealloc{ ...

A C# developers guide to Objective C?

I'm primarily a C# developer and I've been tasked with "porting" functionality from a few apps to an iPhone app. The functionality is simple enough, and a language is a language, so I thought, "sure, why not? This will be fun!" ...That is until I got a look at Objective C, which, to me, is ugly bordering on unreadable. Given that my b...