Delete/Reset all entries in Core Data?

You can still delete the file programmatically, using the NSFileManager:removeItemAtPath:: method. NSPersistentStore *store = …; NSError *error; NSURL *storeURL = store.URL; NSPersistentStoreCoordinator *storeCoordinator = …; [storeCoordinator removePersistentStore:store error:&error]; [[NSFileManager defaultManager] removeItemAtPath:storeURL.path error:&error]; Then, just add the persistent store back to ensure it is recreated properly. The programmatic way for iterating through each entity is both … Read more

How to update a single pod without touching other dependencies

Make sure you have the latest version of CocoaPods installed. $ pod update PODNAME was introduced recently. See this issue thread for more information: $ pod update When you run pod update SomePodName, CocoaPods will try to find an updated version of the pod SomePodName, without taking into account the version listed in Podfile.lock. It … Read more

“Unknown class in Interface Builder file” error at runtime

Despite the “Unknown class MyClass in Interface Builder file.” error printed at runtime, this issue has nothing to do with Interface Builder, but rather with the linker, which is not linking a class because no code uses it directly. When the .nib data (compiled from the .xib) is loaded at runtime, MyClass is referenced using … Read more

What does “@private” mean in Objective-C?

It’s a visibility modifier—it means that instance variables declared as @private can only be accessed by instances of the same class. Private members cannot be accessed by subclasses or other classes. For example: @interface MyClass : NSObject { @private int someVar; // Can only be accessed by instances of MyClass @public int aPublicVar; // Can … Read more

Core Data vs SQLite 3 [closed]

Although Core Data is a descendant of Apple’s Enterprise Object Framework, an object-relational mapper (ORM) that was/is tightly tied to a relational backend, Core Data is not an ORM. It is, in fact, an object graph management framework. It manages a potentially very large graph of object instances, allowing an app to work with a … Read more

What is the best way to unit test Objective-C code?

Xcode includes XCTest, which is similar to OCUnit, an Objective-C unit testing framework, and has full support for running XCTest-based unit tests as part of your project’s build process. Xcode’s unit testing support is described in the Xcode Overview: Using Unit Tests. Back in the Xcode 2 days, I wrote a series of weblog posts … Read more

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