Basic rules are:
Use one NSPersistentStoreCoordinator per program. You don't need them per thread.
Create one NSManagedObjectContext per thread.
Never pass an NSManagedObject on a thread to the other thread.
Instead, get the object IDs via -objectID and pass it to the other thread.
More rules:
Make sure you save the object into the store before...
Friday, October 10, 2014
Wednesday, July 16, 2014
Swift - String in swift [ swift programming language apple ios]
Strings
“Swift strings are represented by the String type, which in turn represents a collection of values of Character type.”
“Unicode-compliant way to work with text in your code. ”
“Swift’s String type is bridged seamlessly to Foundation’s NSString class. ”
“Each Character value represents a single Unicode character.”
“+” to concate...
Swift - Some basic about swift / let var in swift [ swift programming language apple ios]
basic
no smicolon(“Semicolons are required, however, if you want to write multiple separate statements on a single line:”
Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/in/jEUH0.l), no backet for if , for loop, while loop
let - constant
var for variable
defualt compulsory for switch, no break
All swift code...
Swift - Basic data types in swift [ swift programming language apple ios]
Integer
UInt8, Int32,Int64,UInt32,UInt64 etc
Float
Double,Float
“Double has a precision of at least 15 decimal digits, whereas the precision of Float can be as little as 6 decimal digits.”
BOOL
Bool
Boolean constant values, true and false:”
Swift’s type safety prevents non-Boolean values from being be substituted for Bool. The following...
Swift - Generics (like template in c++) [ swift programming language apple ios]
Generics (like template in c++)
“func repeat<ItemType>(item: ItemType, times: Int) -> ItemType[] {
var result = ItemType[]()
for i in 0..times {
result += item
}
return result
}
repeat("knock", 4)”
“// Reimplement the Swift standard library's optional...
Swift - category in Swift / Extension in swift [ swift programming language apple ios]
Extension like category
“Use extension to add functionality to an existing type, such as new methods and computed properties. ”
“extension Int: ExampleProtocol {
var simpleDescription: String {
return "The number \(self)"
}
mutating func adjust() {
self +=...
Swift - Protocol in swift [ swift programming language apple ios]
Protocol
“Classes, enumerations, and structs can all adopt protocols.”
protocol ExampleProtocol {
var simpleDescription: String { get }
mutating func adjust()
}
struct SimpleStructure: ExampleProtocol {
var simpleDescription: String = "A simple structure"
mutating func adjust() {
...
Swift - enum / Enumeration [ swift programming language apple ios]
enum
enum like classes and have methods inside it.
enum Rank: Int {
case Ace = 1
case Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten
case Jack, Queen, King
func simpleDescription() -> String {
switch self {
case .Ace:
...
Swift - Classes / Classes in Swift [ swift programming language apple ios]
Classes:-
use class keyword followed by classname
class Shape {
var numberOfSides = 0
func simpleDescription() -> String {
return "A shape with \(numberOfSides) sides."
}
}
var shape = Shape()
shape.numberOfSides = 7
var shapeDescription = shape.simpleDescription()
class...
Swift - Function declaration and defination [ swift programming language apple ios]
Function declaration and defination
“Use func to declare a function.”
“func greet(name: String, day: String) -> String {
return "Hello \(name), today is \(day)."
}”
“Functions can be nested.”
Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/in/jEUH0.l
return multiple values
“func getGasPrices()...
Monday, May 5, 2014
What is ipa in iPhone / Creating ipa file in iPhone
What is ipa ?
A .ipa file is an iOS application archive file which stores an iOS app. It is usually encrypted with Apple's FairPlay DRM technology. Each .ipa file is compressed with a binary for the ARM architecture and can only be installed on an iOS-device.
.IPA files cannot be installed...
Tuesday, April 8, 2014
Moving from portrait view to Landscape view / Potrait UI orientation to landscape Ui orienttion in Phone iOS / Ui Orientation according to device Orientation / manually forcing orientation / change orientation manually
When u are switching from one view to another view .
First view is Portrait mode and next mode is in Landscape mode .
Even u have implemented
-(BOOL)shouldAutorotate;
-(NSUInteger)supportedInterfaceOrientations;
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration;
USe
+...
-iPhone backboardd[52] : failed to resume in time
Some times u are getting this error
Feb 27 13:18:45 -iPhone backboardd[52] <Warning>: com.xyz.abc failed to resume in time
Main cause for this is the load on main thread.
Try to avoid calling blocking calls for long time on main thread.
Create separate threads for such things.
If u know steps to reproduce follow steps find load...
iOS Architecture [ iPhone ]

reference:-http://www.techotopia.com/
iOS Architecture
Application runs above the Cocoa Touch layer. Application can call any of layer to perform task.
Abstraction increments as layer goes away from hardware.
1. COCOA touch layer:-
Its upper layer...
different type of Application template [ iPhone ] [ xcode ]
Different types of templates in XCode
There are different types of application template in XCode.
Navigation-based Application :- creation application which will having navigation from one view to other.
Open GL ES Application:-creates a basic application containing an Open GL ES view upon which to draw and manipulate graphics.
Split View Application :- An...
Frequently used Design pattern used in iPhone Programming [ iPhone ] [ iOS ]
Model View Controller
Model encapsulates the data for the application, the View presents and manages the user interface and the Controller provides the basic logic for the application and acts as the go-between, providing instructions to the Model based on user interactions with the View and updating the View to reflect responses from the...
Handling AddressBook in iphone [ iOS ]
ABAddressBookRef is class in iOS used to access the address book (a centralized database used by multiple application). with this class we can add, modify, delete the contact.
Create new address book object from address book database.:-
ABAddressBookRef pAddressBook = ABAddressBookCreateWithOptions(NULL, &error);
Each...
Display loading indicator / Activity Indicator / daisy wheel in top status bar [ iPhone ]
In UIApplication:
To start indicator:-
UIApplication* app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = YES;
To stop indicator
UIApplication* app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = NO;
...
About ViewController / view Controller in iPhone [ iOS ]
View Controllers are the link between data and view(visual appearance). Whenever iOS displays anything on screen it is managed by the ViewController or group of ViewControllers coordinating with each other ViewController provides the skeletal framework on which we...
Lazy Instantiation in Objective-C [ iphone ] [ iOS ] [ Objective C ]
Lazy Instantiation (initialisation ) , this technique is good if you have an object that only needs to be configured once and has some configuration involved that you don't want to clutter your init method.
Means in init method does not initialising the object. Initialise object somewhere else in other method of the same class may...
Thursday, January 30, 2014
App ID in iOS / App ID in iPhone

An App ID is a two-part string used to identify one or more apps from a single development team. The string consists of a Team ID and abundle ID search string, with a period (.) separating the two parts.The Team ID is supplied by Apple and is unique to a specific...
Object copying in iOS / Object copying in iPhone / copy function call in iOS iPhone / what will happen when we call copy on object

Object copying
Copying an object creates a new object with the same class and properties as the original object. You copy an object when you want your own version of the data that the object contains. If you receive an object from elsewhere in an application...
what is Selector in iOS / what is Selector in iPhone
A selector is the name used to select a method to execute for an object, or the unique identifier that replaces the name when the source code is compiled. A selector by itself doesn’t do anything. It simply identifies a method. compiler makes sure that selectors are unique.
What makes a selector useful is that (in conjunction...
Monday, January 6, 2014
what is dispatch_once() in iOS / dispatch_once() in iOS
Executes a block object once and only once for the lifetime of an application.
This function is useful for initialization of global data (singletons) in an application. Always call this function before using or testing any variables that are initialized by the block.
If called simultaneously from multiple threads, this function waits synchronously...