Tag: objective c

How can we store a username-password combination in keychain in encrypted format

I need to implement offline login in my application.Currently I am storing passwords in keychain which have been used to login at least once when the app is online.But right now I am not checking the username password combination. If I have multiple users for a single device , storing only passwords won’t be enough. […]

application:didReceiveRemoteNotification:fetchCompletionHandler: not in UIApplicateStateBackground when called

I’ve been puzzled by this for weeks and still no idea what’s going on. The app is setup with background mode to play audio and fetch data. The app is backgrounded and the screen is on lockscreen. The method application:didReceiveRemoteNotification:fetchCompletionHandler: gets called when a remote push arrives. The odd thing is that the application state […]

how to stop performing selector in background?

I have some class A. In this class i have a method, which calls [self performSelectorInBackground:…]. And it starts downloading some info from internet. After i tap Home button, then enter the app again, this background method keeps working. So, if i call this method again, i have bad_access, because background method is already working […]

Objective-C and designing a plugin mechanism

I need to design a simple plugin system in Objective C. I would like some advice about how to go about this. Thanks!

UIKit or CoreGraphics memory leak

It looks like I am experiencing memory leaks in Cocoa libraries? Is it possible? What are your experiences? How can I eventually fix them? leaks http://www.objectivec.cz/transfer/memoryleaks.png

Call class method on object of unknown class

I added a set of classes to an array, all which I know have the same superclass: [array addObject:[Africa class]]; [array addObject:[Brazil class]]; [array addObject:[France class]]; Later, I want to get the class object and call a superclass class method on it. Something like this: Class class = [array objectAtIndex:1]; (Country class) specificClass = class; […]

EXC_BAD_ACCESS after converting HTTP response to string

I have the following code, from which I am getting an EXC_BAD_ACCESS error: – (void)connectionDidFinishLoading:(NSURLConnection *)connection { NSString *responseString = [[NSString alloc] initWithData:receivedData encoding:NSUTF8StringEncoding]; NSLog(responseString); } The weird thing is, the bad access error is actually coming from the NSLog() line, when it tries to access responseString. I’ve even tried adding a retain or autorelease […]

Managing resources in a universal ios app

I am developing a cocos2d game. I need to make it universal. Problem is that I want to use minimun amount of images to keep the universal binary as small as possible. Is there any possibility that I can use same images I am using for iphone, retina and iPad somehow? If yes, how can […]

Should I test public class function, that changes only internal state of the object?

I decided to add unit tests to existing project (quite big one). I am using “google toolbox for mac” for various type of STAssert… and OCMock framework. But I think I’m testing wrong. For example, I have public function saveData, which doesn’t return anything and only change internal state of the object. Should I test […]

Hide and show scrollview with animation

In my app I have a scrollview and when I press a button it is hidden when I press again it shows up. I use scrollview.hidden = YES (or NO) to do it. But I want to do it with an animation. For example, it may disappear from the bottom of the screen by moving […]