[Solved] Xml to dictionary parsing using XML reader [closed]

if you are newbie and don’t know how to parse xml to dictionary… try with the below methods… in .h file add this methods #import <Foundation/Foundation.h> @interface XMLReader : NSObject { NSMutableArray *dictionaryStack; NSMutableString *textInProgress; NSError **errorPointer; } + (NSDictionary *)dictionaryForXMLData:(NSData *)data error:(NSError **)errorPointer; + (NSDictionary *)dictionaryForXMLString:(NSString *)string error:(NSError **)errorPointer; @end and in your .m … Read more

[Solved] How to compare two time from NSDate. Returning nil for nsdate when doing comparision. #debug my code

There was a typo:[dateFormatter setDateFormat:@”HH:mm:ss”]; should be:[formatter setDateFormat:@”HH:mm:ss”]; To compare two dates use: NSDate *date1 = [NSDate date]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@”HH:mm:ss”]; NSDate *date2 = [formatter dateFromString:@”05:00:00″]; NSComparisonResult result = [date1 compare:date2]; if(result == NSOrderedDescending) { NSLog(@”date1 is later than date2″); } If you only want to compare the hours: NSCalendar … Read more

[Solved] How to pass the NSString from One UIViewController to Another UIViewController? [duplicate]

-(IBAction)buttonClicked:(id)sender { //check = [[NSString alloc] init]; — NO Need if (btn1.tag == 0) { check = @”foo”; NSLog(@”%@”,check); } if (btn2.tag == 1) { check = @”bar”; NSLog(@”%@”,check); } ViewController2 *obj = [[ViewController2 alloc] initWithNibName:@”ViewController2″]; [obj setCheck:check]; //push to ViewController2 [obj release]; } In your second view controller, #import <UIKit/UIKit.h> @interface ViewController2 : UIViewController … Read more

[Solved] How to show locations of friends on map near by 20 km from user current location in ios [closed]

Look into -(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations; and use this to get your current location: [locations lastObject]; and to get distance use this: distanceFromLocation: 9 solved How to show locations of friends on map near by 20 km from user current location in ios [closed]

[Solved] Colon after #define in Objective-C [duplicate]

Macros are just replaced by their definition. When you #define k 1024; and write if(k==1024)… what the compiler actually sees is: if(1024; == 1024) … which doesn’t compile. The compiler doesn’t complain because sometimes you may actually want to add a semicolon (; is called semicolon, not colon, which is 🙂 to your macro. solved … Read more

[Solved] NSNumberFormatter thousand separator and trailing zeros

An array balance is an array of NSString NOT NSNumbers. That’s why method stringFromNumber: returns nil. The following example works fine: NSArray *balanceArr =@[@(120.50), @(8500.00)]; NSNumberFormatter *formatter = [NSNumberFormatter new]; [formatter setNumberStyle:NSNumberFormatterDecimalStyle]; [formatter setMinimumFractionDigits:2]; [formatter setGroupingSize:3]; [formatter setGroupingSeparator:@”‘”]; for (NSNumber *balance in balanceArr) { NSLog(@”Straight printing: %@”, balance); NSLog(@”NumberFormatter: %@”, [formatter stringFromNumber:balance]); } Output: 2014-08-22 … Read more

[Solved] How to detect voice in my iPhone app? [closed]

Use AVAudioRecorder – Audio Metering – checkout out this tutorial – dettect when a user blows into mic http://mobileorchard.com/tutorial-detecting-when-a-user-blows-into-the-mic/ Quick Example: _audioRecorder.meteringEnabled = YES; //1. This method will get the current mic activity and will format it to a 0 – 1 scale. -(void)checkRecordingMeters:(NSTimer *)timer { [_audioRecorder updateMeters]; const double ALPHA = 0.2; float peakPower … Read more

[Solved] objective-c – using a boolean value from one class in another class

Introduction Objective-C is a powerful programming language used to develop applications for Apple’s iOS and Mac OS X operating systems. It is an object-oriented language that allows developers to create complex applications with relative ease. One of the most important aspects of Objective-C is the ability to use a boolean value from one class in … Read more