Tag: objective c

How to manage tab bar item in running app in ios

I have created a storyboard with UITabbarController as initial rootViewController and added 6 items in tab bar Till here it is fine. now i need to manage tab bar items on following conditions : if user not logged in – remove 6th item if user logged in – remove 5th item I am able remove […]

jailbroken iOS taking screenshot from background app

I’m building an utility app for myself that can take screenshots of whatever is running in the foreground while this utility is running in the background. The utility will be running on a jailbroken device so it can access private APIs and not confined to the sandbox. Since the utility app is running in the […]

XCODE: How to get/verify ACCURATE timestamp from device

Is it possible to get the NTP or accurate timestamp without internet connection? I cannot take/don’t trust device timestamp with [NSDate date] as it can be modify by user and my apps will be hacked by just modifying the system date & time. Apart from this, instead of obtain accurate timestamp, is there any way […]

Complex NSDictionary. Taken objectsforkeys and sorting them as NSArray or separate variables?

I have an NSDictionary that was converted from XML that is really confusing me. If you could take a look and let me know the best method of getting the objects for the key class_id, I would really appreciate it. { response= { “@status” = ok; rosters = { “@page” = 1; “@page_count” = 1; […]

How do I know if text exceeds the bounds of a text view?

I would like to know when text exceeds the bounds of a UITextView and requires the user to scroll. Knowing how many lines a certain font will occupy is useless – how do I know how many lines a certain amount of text will take up? In the image above, I would add a fade […]

locationOfTouch and numberOfTouches

hi I have this recognizer, set with 2 touch, but it returns only one, not two CGPoint -(void)gestureLoad { UIGestureRecognizer *recognizer; recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(numTap2:)]; [(UITapGestureRecognizer *)recognizer setNumberOfTouchesRequired:2]; [self.view addGestureRecognizer:recognizer]; self.tapRecognizer = (UITapGestureRecognizer *)recognizer; recognizer.delegate = self; [recognizer release]; } – (void)numTap2:(UITapGestureRecognizer *)recognizer { CGPoint location = [recognizer locationInView:self.view]; NSLog(@”x %f y %f”,location.x, […]

Creating a new NSString instance has retain count of 3

I am trying to copy a string that is passed into a method like so: -(void) parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict { NSLog( @”elementName, %@: %i”, elementName, [elementName retainCount] ); // rc = 2 if ( currenttag ) [currenttag release]; NSLog( @”currenttag: %i”, [currenttag retainCount] ); // rc = 0 […]

Finding the cause of EXC_BAD_ACCESS

I have a class with the following init method: – (id)init { self = [super init]; if (self) { // Initialization code here. StateStack* s = [[StateStack alloc] init]; state = s; [s push:NONE]; //<–EXC_BAD_ACCESS on load here [s release]; } return self; } And StateStack has the following init code: – (id)init { self […]

How to convert FLAC file to wav file in ios?

I want to create a audio player that support Flac format of audio files.For this i tried to implement the algorithm of flac to wav conversion which is as follow Please help me. All time it gives me error ERROR: initializing decoder: FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE static FLAC__bool write_little_endian_uint16(FILE *f, FLAC__uint16 x) { return fputc(x, f) != EOF […]

Objective C: How to resolve 'unrecognized selector sent to instance' error

I am trying to access a property of instance object using the following code for (User *user in likersArray) { //Set variables for dictionary NSString *nameLength = [NSString stringWithFormat:@”%i”,[user.nickname length]]; } However, I keep getting the following error: *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[NSCFString nickname]: unrecognized selector sent to instance 0x8c0f780’ […]