objective-c

More Specific, General Objective-C Memory Management.

Everything i've read about objective-c memory management makes it sound incredible easy. To paraphrase everyone: "release whatever you alloc, retain or copy". But I think there are some more specific cases that are not so clear cut. Below are some sample situations. What is the correct procedure for each: SITUATION #1: Foo *foo = [...

Accessing pushViewController's methods from popViewController

Hi All, I am working on a view based application. In this i have two viewcontrollers. They are: Rootviewcontroller and Detailviewcontroller. Now i am passing a values to Detailviewcontroller using pushViewController method.It works fine. But now when i pop out from this Detailviewcontroller i should access myfunction in Rootviewcontrol...

CoreData countForFetchRequest says 'entity not found'

I'm experiencing a strange problem when trying to count the entities in a managed object context. - (NSUInteger)countEntity:(NSString *)entityName inContext:(NSManagedObjectContext *)context{ NSFetchRequest *request = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForNam...

What does "Context" mean in Cocoa/Objective-c?

Recently I've been seeing the word "context" used in method names in Cocoa, but I don't understand the meaning. I've seen it in places like Core Data (NSManagedObjectContext) and in Core Graphics (CGBitmapContextCreate) but it seems to be used all over (NSSet, NSArray, NSObject). I'm assuming that it comes from the c world. What is this...

MulticastDelegate in ObjectiveC

I'm using MulticastDelegate class which is part of xmpp framework and taken here It works perfect for me! However I got warning: 'MulticastDelegate' may not respond to 'someMethod' Is there any way to avoid the warning for this class? Thanks in advance. ...

iPhone: Accessing view objects from a ViewController in Code

NEWBIE QUESTION Let's say I have a ViewController that needs access to a view. In the class file of the ViewController I am doing IBOutlet ViewA *someview; And in IB, I drag and drop a UIView in my document and set the class to ViewA. I am missing how "stuff" is instantiated when you connect through IB. Is ViewA automatically alloca...

How to parse xml file that is encoded with another encoder different from utf-8 with using NSXMLParser in objective-C?

Is there a way to parse xml file that is encoded with windows-1254 with using NSXMLParser? When i try, didStartElement method not called. ...

objective C - NSString and substring

I have an NSString like that :" abc xyz http://www.abc.com aaa bbb ccc" How can I get the substring http://www.abc.com from that NSString? Thanks in advance. ...

Core Data Deletion rules and many-to-many relationships

Say you have departments and employees and each department has several employees, but each employee can also be part of several departments. So there is a many-to-many relationship between employees and departments. When deleting a department I would like to delete all employees that are only part of that department and nullify the rela...

how to get path of temp recorded video file in iphone sdk and play?

i know if we record video in iphone 3gs the video will be stored in temporary directory.so how do i get the path and play the video using mpmovieplayer? ...

Animating views

i have a tableview with multiple rows.row values dynamically changes every 2 secs except last row .i like to add a rotating view in the last row. how to add a animating view in the last row? how to rotate a view inside a tableviewcell? i'm not looking for a UIActivityindicator. i want to rotate my view around z axis. ...

why uislider calling a method twice?

i have set an ibaction(touch up inside) to uislider.when i slide the slider and moves my finger up it is called twice.anyone knows about it? or if someone knows about how to call a method when lifting finger up from uislider.Note i have already a method(Value changed) bound to uislider ...

Unexplained leaks using CFDictionaryRef and ABMutableMultiValueRef

The following code is creating a number of leaks which I do not understand as I release all objects created with Create or Copy. I have not worked with CF objects extensively so I may have a misunderstanding of the retention cycle. Any help would be appreciated please: ABMutableMultiValueRef webServices = ABRecordCopyValue(aRecord, kABP...

how to get first frame of recorded video using iphone sdk?

i have read in this Stack Overflow Post that how to get thumbnail..... but i want to get full frame of the video so that i can show that in uiimage view.is there a way to do this? ...

OCMock returning values

Hey all, I'm trying to write a test for a method where the output depends on an NSDate's timeIntervalSinceNow return value. I'd like to specify the return value in my tests so I can test certain scenarios. I'm having a really hard time getting this OCMock object returning what I'd like. Here's my code: id mock = [OCMockObject mockForC...

iPhone SDK audioSession question.

Hi to all. In my app i record and play audio at the same time. The app is almost finished. But there is one thing, that annoying me. When audio session is set to PlayAndRecord, sounds become quiet in comparison with the same sounds with the SoloAmbient category. Is there any way to make sound louder using PlayAndRecord? ...

How to get user response when prompted for core location?

When I install my application on the iPhone it asks for the current location with the options "Don't allow" and "Ok" in an alert. How do I find out which option was chosen? I also want to show this option only once. If the user chooses to allow their current location to be found, I want the device to automatically get the location in the...

CGImageRef and drawing layers

I have this code: CGDataProviderRef provider = CGDataProviderCreateWithFilename([myFile UTF8String]); CGImageRef img = CGImageCreateWithJPEGDataProvider(provider, NULL, true, kCGRenderingIntentDefault); Later I load that CGImageRef in a UIImage this way: UIImage *uiImage = [[UIImage alloc] initWithCGImage:destImage]; I'd like to dr...

Objective-C with cpp extensions, I don't know what I'm doing...

So I'm still feeling like a novice at times when strange errors jump out of XCode. Yesterday I started getting this: ___gxx_personality_v0", referenced from: ___gxx_personality_v0$non_lazy_ptr That was when building a unit test target that used a ".mm" file in XCode with the iPhoneSDK. The error went away when I changed the file ...

NSArray of Dates sort

Consider this array. It has no keys, so I am not sure I can use NSSortDescriptor. What would be the best method to sort them? ( "Thursday, July 30, 2009", "Monday, September 07, 2009", "Wednesday, September 09, 2009", "Friday, August 14, 2009", "Saturday, September 05, 2009", "Monday, August 10, 2009", "Thu...