Top "Foundation" questions

Foundation is a framework written in Objective-C that implements many useful classes and functions.

Does NSSet's containsObject: test for pointer equality or value equality?

Say I have an NSSet with a string in it. If I send containsObject: with another string which is a …

objective-c cocoa collections foundation nsset
How to delete the contents of the Documents directory (and not the Documents directory itself)?

I want to delete all the files and directories contained in the Documents directory. I believe using [fileManager removeItemAtPath:documentsDirectoryPath …

iphone objective-c foundation
Swift Playground - Files are not readable

Files are not readable in Swift Playground. How to make files readable? Same code runs well on Xcode terminal app, …

xcode swift xcode6 foundation swift-playground
NSURLSessionConfiguration HTTPAdditionalHeaders not set

Authorization header is set in NSURLSessionConfiguration, however it is not attached to NSURLSessionDataTask. Is this a bug in Foundation framework? …

ios nsurlrequest foundation nsurlsession nsurlsessionconfiguration
CFRunLoopRun() vs [NSRunLoop run]

I have an NSRunLoop object, to which I attach timers and streams. It works great. Stopping it is another story …

macos foundation core-foundation nsrunloop cfrunloop
NSUserDefaults boolforKey limitation by design?

The NSUserDefaults API documentation has the boolForKey: message which is described like this - boolForKey: Returns the Boolean value associated …

iphone ios cocoa api foundation
NSLocaleCountryCode returns nil

I have a bugreport that states a crash in the following line, where client is an instance of NSMutableDictionary [client …

ios foundation country nslocale
Can't pass Date to NSPredicate(format: ...) without "as CVarArg"

Is this how I'm supposed to pass a Date to NSPredicate.init(format predicateFormat: String, arguments argList: CVaListPointer). let endDate = …

swift swift3 nsdate nspredicate foundation
Saving time in UserDefaults

I'm working on a little game. When the user has a game going and shuts down the game, the app …

swift date foundation userdefaults
Swift 2 : NSData(contentsOfURL:url) returning nil

I have a webpage address which contains a JSON file. I'm trying to access the JSON file as NSDictionary in …

ios json xcode foundation swift2