iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

NSDateFormatter time zone abbreviation

I need to recognize date strings like Tue Aug 13 17:29:20 MSK 2013. And, as I know, to do that I need to use ‘V’ symbol in NSDateFormmater, but it only recognizes GMT+04:00 like time zones. Is there any other way to parse time zone abbreviation? Here is the code: NSDateFormatter *dft = [[NSDateFormatter alloc] […]

iOS: Get all dates in current week

I am trying to get all dates in the current week of a given date: In the example below, the input is 2015-11-29 23:40:37 +0000 , so I would expect the output to be an array of dates from November 23 – November 29, but the actual output is November 30 – December 6. -(NSArray […]

Has xcode 4.5 changed sortedArrayUsingComparator + blocks?

Just updated xcode to 4.5 and I’m receiving an error in one of my iOS apps which I wasn’t getting previously. Problem was not occurring before the update. Basically, I have an array that needs sorting, based on some other irrelevant tests.. NSArray *sortedArray = [arrayFiles sortedArrayUsingComparator:^(id a, id b) { NSString *first = [(PPFile*)a […]

FacebookSDK in iOS Does not show close button and not able to close

Hi I have integrated Facebook SDK for an iOS 6 app.The Facebook authentication & sharing works perfectly but there are no provision to close the FB Dialogue When FB Dialogue box opens,it will be closed only after authentication success.No provision to close or navigate back.How can I make a close button.The code snippet I […]

How interpret stack traces when it stops on main

Often I get stack traces such as this: 0 StackAsk 0x0007fc0d +[TFCrashHandler backtrace] + 429 1 StackAsk 0x0007fe4b TFHandleExceptions + 35 2 CoreFoundation 0x33d56987 __handleUncaughtException + 74 3 libobjc.A.dylib 0x3583d2d1 _objc_terminate + 128 4 libc++abi.dylib 0x34a763c5 _ZL19safe_handler_callerPFvvE + 76 5 libc++abi.dylib 0x34a76451 _ZdlPv + 0 6 libc++abi.dylib 0x34a77825 __cxa_current_exception_type + 0 7 libobjc.A.dylib 0x3583d235 objc_exception_rethrow […]

How to change int value in block?

How change int value in block, I have this : __block long long size = -1; ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset) { ALAssetRepresentation * rep = [myasset defaultRepresentation]; size = [rep size]; //here showed normal value NSLog(@”needed size : %lld”,size); }; ALAssetsLibrary* assetslibrary = [[[ALAssetsLibrary alloc] init] autorelease]; [assetslibrary assetForURL:self.tmpVideoURL resultBlock:resultblock failureBlock:nil]; //but here remaind […]

Parsing an NSXMLElement in Cocoa

I’m trying to use XPath to parse an XML document. One of my NSXMLElement’s looks like the following, hypothetically speaking: <foo bar=”yummy”> I’m trying to get the value for the attribute bar, however any interpretation of code I use, gives me back bar=”woo”, which means I need to do further string processing in order to […]

Why is the retain count of @1 equal to 7, 8 or 10?

I created an empty iOS app on Xcode 4.4.1, and did the following: NSNumber *n1 = @1; NSNumber *n2 = @2; NSNumber *n3 = @3; NSNumber *n100 = @100; NSString *s = @”haha”; NSArray *a = @[n1, s]; NSDictionary *d = @{ @”ha” : @1, @3 : @”hello” }; NSLog(@”retain count of @1 is %i”, […]

How to suppress a “SpriteKit Texture Atlas Generator Warning”?

Xcode is reporting the following warning: “SpriteKit Texture Atlas Generator Warning Splitting ‘images.atlas’ into 2 texture atlases due to input texture dimensions.” Although I will modified my images in the future to avoid SpriteKit from generating this warning, I would like to temporarily suppress this warning using some pragma directives. Does anyone know the warning […]

iphone how to specify the Class data type have to adopt to a protocol

In my application, I need to return the “Class” as a return type like: Application.m: + (Class)getParserClass { return [NCCurrencyParser class]; } NCCurrencyParser.m: @interface NCCurrencyParser NSObject <NCParser> @protocol NCParser +(NSNumber *)parserNumber:(NSNumber *)number; in the caller method: Class parserClass = [Application getParserClass]; [parserClass parserNumber:1.0]; But then the compiler gives me the error that parserClass may not […]