What is the right choice between NSDecimal, NSDecimalNumber, CFNumber?

If you are dealing with financial computations, you really should use base-10 arithmetic to avoid the rounding errors that can occur with the standard base-2 floating point types. So it’s either NSDecimal or NSDecimalNumber. And since you’re writing object-oriented code, NSDecimalNumber is the right choice for you. To answer your questions: only testing of your … Read more

Jumping from iOS to OSX [closed]

Let me put it this way: Don’t just try to port all your stuff over to the Mac without thinking about design principles. A lot of developers are seeking to get on the Mac developer bandwagon without putting time into their apps. Simply moving apps from iOS to Mac doesn’t bring forth good interfaces. Face … Read more

Extract object (*.o) files from an iPhone static library

That’s because your CustomiPhoneLib.a is a fat library, i.e., a library that contains more than one target architecture, namely armv6 and armv7 on iOS. You can use lipo to extract a specific architecture into another .a file, use ar and ranlib to manipulate it at will, and then use lipo again to recombine the manipulated … Read more

How to safely shut down a loading UIWebView in viewWillDisappear?

A variation on this should fix both the leaking and zombie issues: – (void)loadRequest:(NSURLRequest *)request { [self retain]; if ([webView isLoading]) [webView stopLoading]; [webView loadRequest:request]; [self release]; } – (void)webViewDidStartLoad:(UIWebView *)webView { [self retain]; } – (void)webViewDidFinishLoad:(UIWebView *)webView { [self release]; } – (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { [self release]; } – (void)viewWillDisappear { if … Read more

Add UIActivityIndicatorView into UIBarButton

If you’re trying to show the activity wheel in a navigation bar button (e.g. you might have a refresh button on your navbar) – you can create a new UIBarButtonItem with a custom view being the UIActivityIndicatorView: Objective-C uiBusy = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; uiBusy.hidesWhenStopped = YES; [uiBusy startAnimating]; [self.navigationItem.rightBarButtonItem initWithCustomView:uiBusy]; Swift let uiBusy = UIActivityIndicatorView(activityIndicatorStyle: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)