Sending an HTTP POST request on iOS

The following code describes a simple example using POST method.(How one can pass data by POST method) Here, I describe how one can use of POST method. 1. Set post string with actual username and password. NSString *post = [NSString stringWithFormat:@”Username=%@&Password=%@”,@”username”,@”password”]; 2. Encode the post string using NSASCIIStringEncoding and also the post string you need … Read more

NSString to CFStringRef and CFStringRef to NSString in ARC?

Typically NSString *yourFriendlyNSString = (__bridge NSString *)yourFriendlyCFString; and CFStringRef yourFriendlyCFString = (__bridge CFStringRef)yourFriendlyNSString; Now, if you want to know why the __bridge keyword is there, you can refer to the Apple documentation. There you will find: __bridge transfers a pointer between Objective-C and Core Foundation with no transfer of ownership. __bridge_retained or CFBridgingRetain casts an … Read more

Weak and strong property setter attributes in Objective-C

Here is what I know about variable properties atomic //default nonatomic strong=retain //default weak retain assign //default unsafe_unretained copy readonly readwrite //default so below is the detailed article link where you can find above mentioned all attributes, that will definitely help you. Many thanks to all the people who have given the best answers here!! … Read more

UIPopovercontroller dealloc reached while popover is still visible

UIPopoverControllers should always be held in an instance variable. It is a good practice to create a strong property for it. UPDATE: As of iOS 8 you should be using UIPopoverPresentationController. Then you don’t need to keep a reference to the popover because it is managed by the presentation controller. Code example (works both on … Read more