objective-c

How to filter records in CoreData using NSPredicate

I have amount attribute in coredata model with string datatype. I need to find records by comparing amount. I have tried NSPredicate with following but nothing is coming and result is always empty. NSDecimal result; NSScanner *theScanner = [[NSScanner alloc] initWithString:@"10.00"]; [theScanner scanDecimal:&result]; [theScanner release...

Xcode Obj-C Why is 7/10 not 0.7

int a=7 int b=10 float answer = (float)a/b; answer=0.699999988 ( I expect 0.7 ??) ...

iOS 4 Location Service Prompt Dialog Doesn't Show Up

I'm experiencing an issue with how iOS 4 manage Location Service. Previously, when the location service is disabled, any application that uses location service will prompt the user to turn it on. However, in iOS 4, it didn't prompt that dialog box and just stays quiet. Is there a way to call the default dialog box which ask the user to t...

How to best turn on/off unit tests using #defines

I have a file with unit tests testOne() {...} testTwo() {...} ... but when I am troubleshooting I would like to turn off all except the unit test that is causing problems (due to massive amount of logging). At the moment I have done like this: #if 0 testOne() {...} #endif .. #if 1 testTroublesome() {...} #endif But I was wo...

XCode/Static Analyzer: Suppressing a retain count/leak warning

Hi all, I have a function that is creating a variable, but not deallocating it. It passes this object on with a message to another function that deals with the memory management. My question is how do I suppress the static analyzer warning for what XCode thinks is an over-retained variable? I thought I could use NS_RETURNS_RETAINED f...

How to disabled the UITabBarController buttons in the Master View Controller in iPhone sdk, objectiveC?

Hi Guys, I got one problem, that is when I tab the UITabBarController buttons, While Loading the data, I am getting exception. How can I get through it. Is there any idea or can we disabled the buttons but it is opposite to programing. ...

Animate the change between detailviews on UISplitViewController

Currently This is how i change between detailviews from the right navigation bar UIViewController <SubstitutableDetailViewController> *detailViewController = nil; NSString * type = [self selectview:arb]; DetailViewController *newDetailViewController = [[DetailViewController alloc] initWithNibName:type bundle:nil]; detailViewController...

Getting leak at stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]

Hi, I am getting leak at below code: search.h NSString *str; search.m -(void)searchMethod:(UISearchBar *)aSearchBar { /*******Showing leak at below line *************/ str=[aSearchBar.text stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]]; } I am not getting how to s...

Debugging touchesEnded NOT being called when swiping in 1 direction only

Hi Totally stumped in debugging a simple swipe movement for my application. When I swipe in a left direction, I correctly get a touchesEnded message-method call. BUT, if I drag in the other direction, touchesEnded does NOT get called. Anyone have a clue as to why this might be? I'm using a TapDetectingView as my view for my viewControl...

Old Dog, New Tricks - Whats the best way for a Java/C# Coder to Learn Objective-C?

Possible Duplicates: A good book about Objective-C 2.0 for an experienced C/C++/Java/C# developer Best way to learn Objective-C I've been happily coding Java and C# for about twelve years but my experience of C and other low-level languages is minimal. I have an MSc in Comp Sci but the course was geared towards internet appl...

Detecting steps taken during walk using IPhone

hi Guys! is it possible that i can detect with application for the amount of indoor walk using Iphone SDK. ? if so then what steps should i follow to achieve. thanks ...

Memory Leaks in Lib Xml Parser

Hi Guys, If I do nil, I am not getting the leaks but I am getting the exceptions due to nil object. I am getting its retain count as 4. How can I make its retain count to 0 - (void) dealloc { printf("\n Hai I am in Dealloc Method of Customer Lib Xml Parser......................"); self.connection = nil; xmlFreeParserCtxt(_xmlParserCont...

Why can't I tap input elements after I resize a scroll view?

I have a sample project that uses the metrics from notifications for resizing the keyboard when a text field is focused. http://www.smallsharptools.com/downloads/ObjC/KeyboardSize.zip The series of text fields are all wrapped inside of a UIScrollView and when the keyboard is shown a notification is sent with the height value. I use tha...

Loading an Array Image item using the formatted NSString

I want to load an image from an array and set the view to display this image. The current code isnt loading anything, just a gray image full screen. myView.image = [UIImage imageNamed:[names objectAtIndex:r]] If I have a counter r, which I use to access the index. How could it be done to load an image as such myView.image = [UIImage...

how do I catch all exceptions in iphone?

I need to catch ALL exceptions and errors in an iphone app. Obviously, this is only for really strange cases where the exception or error is totally unexpected. In those cases, it would be nice to log the error or something, so as to get knowledge of the issue and fix it in the future. Do you know a way to catching ALL exceptions or err...

Comparing values In 2 different NSArray objects

I have 2 NSArray's that are holding values... For example NSArray 1 has values 1 2 4 in it and NSArray 2 has values 1 2 4 5 6 in it. How can I write code to compare these 2 arrays to get the following information... Count the values that are the same (so in this case 3) and count the values that are not the same (in this case 2). I ...

Instruments Living Count and/or Retain Count Issue

I'm running into a retain count issue that I do not understand. (I've added what I believe to be the retain count of vertex in [] at the end of each line of code). CBVertex *vertex = nil; for(int i=0; i<10; i++) { vertex = [[CBVertex alloc] initWithFrame:CGRectMake(minX, y, 10.0, 10.0)]; // retain count [1] [vertex setTag:i]; ...

UISlider thumb image issue..!

Hi all, How can we set the thumb image of UISlider to stop once it reaches the max value .i.e once the thumb image reaches the max value(at the end) user should not be able to move the thumb image. ...

Turning a command line app into a Cocoa GUI app on Mac OS X?

Is there any tutorials or references, if such thing is possible, to make GUI applications out of command line apps? What I mean is, having a command line app, wrap it into an app bundle and create a Cocoa GUI app that would have a simple interface to execute the command line app with its flags and parameters. ...

Problem with copying main application

OK , the eXercice is about to get the path to the running application i have done this by : NSFileManager *FManager = [ NSFileManager defaultManager ] ; NSString *CurrentPath = [ FManager currentDirectoryPath ] ; NSDictionary *infoPList = [[NSBundle mainBundle] infoDictionary]; NSString *appName = [infoPList objectForKey:@"CFBu...