Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Error in __weak typeof(self)weakSelf = self

If you have error in line __weak typeof(self)weakSelf = self; replace this line with __typeof__(self) __weak weakSelf = self;

Play a video from a URL in iPhone SDK

To play a video from a url in iPhone sdk just write down following line of code: Step 1: Create a MPMoviePlayerViewController object as *moviePlayerController. Step 2: Create a Url and initialize your movieController with Url. Step 3: and No...

Download Files Using DropBoxSDK in iOS

If You want to get the list of all the files that are uploaded on your DropBox then use the following code : method -(void)downloadAllData:(void (^)(NSMutableArray *, NSMutableArray *, BOOL)) block need to be called after the successful lo...

Invalid attempt to access ALAssetPrivate past the lifetime of its owning ALAssetsLibrary

When accessing assets in the iPhone, some time users gets this error. (Invalid attempt to access ALAssetPrivate past the lifetime of its owning ALAssetsLibrary) so we can initialize our assetLibaray using the following code: + (ALAssets...

How to convert NSData to NSString or vice versa in Objective C and Swift

Hi Readers! In this blog you can find both versions (Obj C & Swift) for converting NSData to NSString or vice-versa. Objective C NSString * str = @"Hello"; NSData * data =[str dataUsingEncoding:NSUTF8StringEncoding]; NSLog(@"Data = ...

DropBox Login Integration Using iOS SDK

Download the DropBox SDK from the https://www.dropbox.com/developers/sync/sdks/ios add this sdk to Your project and also add some other Frameworks. 1. Foundation.framework 2. UIKit.framework 3. CoreGraphics.framework 4. QuartzCore.fra...

Fetch profile pic from Facebook

For some reasons Facebook doesnt provide profile picture with user info dictionary/data. We need to fetch profile pic using graph api. Once user is done with successful authentication he can use following snippet to get profile picture URL. ...

How to iterate or remove all key object from NSUserDefaults

Hi Readers, In any iPhone app if it is needed to iterate or remove NSUserDefault keys (as in logout feature), following code can be used: To iterate key objects: NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults]; ...

How to get sub strings from a string using Regular Expression

Hi, The below code is to get substrings from a string. You are going to love this below code which is very simple but very effective. I have used regular expression to get the sub strings. NSString *strTest = @"Hii how are you doing @Ravi , h...

When to use copy Attribute in declaring a property in objective c

We all use attributes in Objective C to declare properties. Attributes commonly used are strong, nonatomic, weak, assign. But we never take it seriously why we are using these attributes. One of the common mistakes I often see is the wrong us...

__weak and __unsafe_retained

__weak and __unsafe_unretained are the ownership qualifiers introduced by LLVM Compiler 3.0. By default all pointers are __strong under ARC which means that when an object is assigned to a pointer, it is retained for as long as that pointer re...

Tabbar Customization

Snippet works all around to customize the tabbar icons & texts display color for selected and unselected state for iOS7 self.tabbarController.tabBar.tintColor = [UIColor greenColor]; Below code can be used to customize the text look. ...

Objective C coding style

Language US English should be used. Preferred: UIColor *myColor = [UIColor whiteColor]; Not Preferred: UIColor *myColour = [UIColor whiteColor]; Code Organization Use #pragma mark - to categorize methods in functional groupin...

Memory management under ARC

ARC Memory management 1)Methods you cant call (or override) anymore You will have to remove all calls to these methods without substitution: 1)retain 2)retainCount 3)release 4)autorelease 5)Dealloc You also cant use the re...
prev 1 2 next
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: