tag:blogger.com,1999:blog-84350313880228113922015-02-26T20:59:14.447-08:00Gaurav S TomarI live like I type, fast and with lots of mistakes.Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.comBlogger126125tag:blogger.com,1999:blog-8435031388022811392.post-55905400801797742802014-10-21T23:36:00.000-07:002014-10-21T23:37:55.572-07:00UIActionSheet in iOS 8<div dir="ltr" style="text-align: left;" trbidi="on"> <b>UIActionSheet</b> and <b>UIActionSheetDelegate</b> is deprecated in iOS 8. To create and manage action sheets in iOS 8 / later, we need to use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet because if we have used the same in our previous code it will simply not appear in iOS 8. Don't panic! It won't make a crash ;) <br /><b>PFB</b> - <i>A quick adaptation for UIActionSheet/Delegate</i><br /><br /><a name='more'></a><h2>till iOS 7</h2><pre class="prettyprint"><br /><br />#pragma mark<br />#pragma mark Show options to pick image<br />-(void)pickImage:(UIButton*)sender{<br /> UIActionSheet *changeImageAction = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:<br /> @"Capture Photo",<br /> @"Select from Gallery",<br /> nil];<br /> [changeImageAction showInView:[UIApplication sharedApplication].keyWindow];<br />}<br /><br />#pragma mark<br />#pragma mark UIActionSheetDelegate<br />- (void)actionSheet:(UIActionSheet *)popup clickedButtonAtIndex:(NSInteger)buttonIndex {<br /><br /> switch (buttonIndex) {<br /> case 0:<br /> NSLog(@"Open camera");<br /> if ( [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] ){<br /> [self getImage:UIImagePickerControllerSourceTypeCamera];<br /> }<br /> break;<br /> case 1:<br /> NSLog(@"Open gallery");<br /> [self getImage:UIImagePickerControllerSourceTypePhotoLibrary];<br /> break;<br /> default:<br /> break;<br /> }<br /><br />}<br /></pre> <h2>from iOS 8</h2><pre class="prettyprint"><br /><br />#pragma mark<br />#pragma mark Show options to pick image<br />-(void)pickImage:(UIButton*)sender{<br /><br /> <br /> <br /> UIAlertController *alertController = [UIAlertController<br /> alertControllerWithTitle:@"Change image"<br /> message:@""<br /> preferredStyle:UIAlertControllerStyleActionSheet];<br /> <br /> UIAlertAction *cancelAction = [UIAlertAction<br /> actionWithTitle:@"Capture Photo"<br /> style:UIAlertActionStyleDefault<br /> handler:^(UIAlertAction *action)<br /> {<br /> NSLog(@"Open camera");<br /> if ( [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] ){<br /> [self getImage:UIImagePickerControllerSourceTypeCamera];<br /> }<br /> }];<br /> <br /> UIAlertAction *okAction = [UIAlertAction<br /> actionWithTitle:@"Select from Gallery"<br /> style:UIAlertActionStyleDefault<br /> handler:^(UIAlertAction *action)<br /> {<br /> NSLog(@"Open gallery");<br /> [self getImage:UIImagePickerControllerSourceTypePhotoLibrary];<br /> }];<br /> <br /> <br /> <br /> <br /> UIPopoverPresentationController *popover = alertController.popoverPresentationController;<br /> <br /> if (popover)<br /> {<br /> popover.sourceView = sender;<br /> popover.sourceRect = sender.bounds;<br /> popover.permittedArrowDirections = UIPopoverArrowDirectionAny;<br /> }<br /> <br /> [alertController addAction:cancelAction];<br /> [alertController addAction:okAction];<br /> <br /> [self presentViewController:alertController animated:YES completion:nil];<br /> <br />}<br /><br /></pre> </div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/cSRCk5xKHLY" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com0Noida, Uttar Pradesh, India28.5355161 77.39102649999995328.312280599999998 77.068302999999958 28.7587516 77.713749999999948http://gauravstomar.blogspot.com/2014/10/uiactionsheet-and-uiactionsheetdelegate.htmltag:blogger.com,1999:blog-8435031388022811392.post-35284222880974015262014-09-20T22:34:00.003-07:002014-09-20T22:34:50.496-07:00UIImage fill color Objective C<div dir="ltr" style="text-align: left;" trbidi="on">Just created an ObjectiveC POC for UIImage color filling with <a href="http://en.wikipedia.org/wiki/Flood_fill">flood fill</a> algorithm.<br /><br /><br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-F6GzbVNsRqs/VB5hFcRQ7uI/AAAAAAAAUeA/j5pLyWNd6cM/s1600/FloodFill.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-F6GzbVNsRqs/VB5hFcRQ7uI/AAAAAAAAUeA/j5pLyWNd6cM/s320/FloodFill.gif" height="300" width="400" /></a></div><br /><b><br /></b><b>Sample code: <a href="https://github.com/gauravstomar/Image-fill-color-ObjectiveC">https://github.com/gauravstomar/Image-fill-color-ObjectiveC</a></b> </div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/SAOHJyFJNv0" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com0http://gauravstomar.blogspot.com/2014/09/uiimage-fill-color-objective-c.htmltag:blogger.com,1999:blog-8435031388022811392.post-44301394474748151372014-06-30T04:42:00.000-07:002014-06-30T04:42:56.459-07:00UIView controls greyed out in iOS7<div dir="ltr" style="text-align: left;" trbidi="on">When opening and closing sheets and popovers in iOS7 the ui-controls like UISegmentedControl, UIProgressView, etc. <br>Its in the Apple's native app as well, where the bar button items become greyed, or conversely, they no longer turn to grey once a popover/viewcontroller shows up. <br><br>Its an open bug in iOS7, for quick fix we can manually set <b>tintAdjustmentMode</b> property of the effected UIView to <b>UIViewTintAdjustmentModeNormal</b>, e.g; <pre class="prettyprint"><br />UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithFrame:CGRectMake(x, y, width, height)];<br />segmentedControl.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;<br /></pre><br /><i>NOTE: This will prevent the color toggling in any case, i.e; there will be no effect of dimming when opening Popover/Sheet/ViewController</i><br /><br /></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/UpBlKaC-IG4" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com0http://gauravstomar.blogspot.com/2014/06/uiview-controls-greyed-out-in-ios7.htmltag:blogger.com,1999:blog-8435031388022811392.post-33946874935571302182014-06-27T00:08:00.000-07:002014-06-27T00:08:05.156-07:00Handoff in iOS8<div dir="ltr" style="text-align: left;" trbidi="on"> Handoff is all about making you work across all devices within proximity range. It uses BTLE (<i>Bluetooth low energy or Bluetooth LE </i>) and iCloud account to pair devices. After pairing in iOS it display the current app icon in left corner of the lock screen, left side of home screen in multitasking switcher screen, On Mac it shows in right part of the dock and <i>command + tab</i> menu <br><br>Handoff supports live streaming between apps in two devices. Handoff works in between websites and apps as well. <br><br>Fundamental unit of handoff is an <b>Activity (<i>NSUserActivity</i>)</b>. When we create an Activity it automatically brodcasts and shows up in paired devices. When user selects the Activity (<i>i.e; select the app</i>) the host is informed and asked for the detaled information, after that host sends the detailed package and the app get launched. <br><br>All applications from the same developer can exchange activities this is based on the team identifier. Applications don't have to claim; <ul> <li>the same activity type they create</li> <li>any activity types, but can still create them</li></ul>This is helpful when there are multiple apps in iOS for an app in OSX <br><br>Creating, Updating and Continuing Activity is supported by AppKit and UIKit, i.e; UIDocument, UIResponder now have a NSUserActivity property. In UIDocument based apps the activity is set in .plist and will be managed by OS itself. In UIResponder, when the app is in focus UIKit walks the view hierarchy and check for the Activity. Every time user focus the Activity it evokes the <b>becomeCurrent</b> method and <b>invalidate</b> when it finished. To manage user, Activity have <b>userInfo</b> property for minimal ammont of information. It is a dictonary and can store NSArray, NSData, NSDate, NSDictonary, NSNull, NSNumber, NSSet, NSString, NSUUID, NSURL.. <br><br>UIApplicationDelegate have new method (<i>i.e; application:continueUserActivity:restorationHandler:</i>) which tells the delegate that the data for continuing an activity is available. This method have a optional block, <b>restorationHandler</b> which executes if your app creates or fetches objects to perform the task it must be called from the app’s main thread. <b>restorationHandler</b> has no return value and take <b>restorableObjects</b> as param which is an array of UIResponder or UIDocument objects representing objects you created or fetched in order to perform the operation. <br><br>When continued from another device <b>NSUserActivityDelegate</b> call <i>userActivityWasContinued:</i> which notifies the delegate that the user activity was continued on another device. This will helpful when more then two devices are paired and Handoff on the same app. <br><br> <br /></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/T0BPiXem6fw" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com0http://gauravstomar.blogspot.com/2014/06/handoff-in-ios8.htmltag:blogger.com,1999:blog-8435031388022811392.post-47428173116439589472014-06-23T22:48:00.001-07:002014-06-23T22:48:58.570-07:00Extensions in iOS - Keynote<div dir="ltr" style="text-align: left;" trbidi="on"> <ol> <li>Not all but most of the APIs are available for extesions</li> <li>Extensions have separate container for them which means they act like a saperate app for there parent app</li> <li>Extensions don't have access to their parent app data but can opt into data sharing</li> <li>Apps and Extensions can use a shared container/storage area which can be accessed at same time with the help of; <ul> <li><b>NSFileCordination</b> - provides general syns strategy for app and extension</li> <li>CoreData</li> <li>sqilite</li> <li><b>NSUserDefaults</b> - with a shared suite name</li> <li>Shared Keychains - for an app group</li> </ul> </li> <li>Once user approve the Privacy access (e.g; Photos, Location..) to an app all its extensions don't need to ask saperately</li> <li>Extensions are stateless that means they are killed aggressively</li></ol><br><br> <b>Extensions configuration keys in .plist</b><ul> <li><b>NSExtension</b> - A dictionary of keys and values that describe an app extension <ul> <li><b>NSExtensionPointIdentifier</b> - Extension point’s reverse DNS name <i>PFB</i></li> <li><b>NSExtensionPrincipalClass</b> - The name of the principal view controller class created by the template</li> <li><b>NSExtensionAttributes</b> - A dictionary of extension point–specific attributes that specify aspects of an app extension <ul> <li><i>further configuration based on extension kind</i></li> </ul> </li> </ul> </li></ul><br><br> <b>Values for the NSExtensionPointIdentifier key based on extension type;</b><ul> <li><b>Action Extension</b> - com.apple.ui-services</li> <li><b>Custom Keyboard Extension</b> - com.apple.keyboard-service</li> <li><b>Document Picker Extension</b> - com.apple.fileprovider-ui</li> <li><b>File Provider Extension</b> - com.apple.fileprovider-nonui</li> <li><b>Finder Sync Extension</b> - com.apple.FinderSync</li> <li><b>Photo Editing Extension</b> - com.apple.photo-editing</li> <li><b>Share Extension</b> - com.apple.share-services</li> <li><b>Today Extension</b> - com.apple.widget-extension</li></ul> <br /></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/3zPUgl9Mr-Y" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com0http://gauravstomar.blogspot.com/2014/06/extensions-in-ios-keynote.htmltag:blogger.com,1999:blog-8435031388022811392.post-42515850681914809362014-06-19T02:51:00.000-07:002014-06-19T22:17:07.634-07:00View Controllers in iOS 8 - A quick review<div dir="ltr" style="text-align: left;" trbidi="on"> <h2>High level changes</h2> <table> <tr style="background:#fafafa"><td style="text-align:right"><b>Traits</b></td> <td>replaced <del>UIViewController methods and properties for interface orientation</del> <i>PFB</i></td></tr> <tr><td style="text-align:right"><b>UIAlertController</b></td> <td>replaced <del>UIActionSheet</del> and <del>UIAlertView</del></td></tr> <tr style="background:#fafafa"><td style="text-align:right"><b>UISearchController</b></td> <td>replaced <del>UISearchDisplayController</del></td></tr> <tr><td style="text-align:right"><b>UIUserNotificationSettings</b></td> <td>replaced <del>UIApplication methods and properties for registering notifications</del>, supported register the types of alerts local or push notifications with some custom actions apart from remote notifications</td></tr> <tr style="background:#fafafa"><td style="text-align:right"><b>UISplitViewController</b></td> <td>supported on iPhone as well as iPad with new <b>collapsed</b> property <i>PFB</i></td></tr> <tr><td style="text-align:right"><b>UINavigationController</b></td> <td>added options to condensing and hiding <i>PFB</i></td></tr> <tr style="background:#fafafa"><td style="text-align:right"><b>UIPresentationController</b></td> <td>provides advanced view and transition management for presented view controllers <i>PFB</i></td></tr> <tr><td style="text-align:right"><b>UIPrinterPickerController</b></td> <td>view controller-based way to display a list of printers</td></tr> <tr style="background:#fafafa"><td style="text-align:right"><b>UIPopoverPresentationController</b></td> <td>manages the display of content in a popover</td></tr> </table><br><br> Methods for showing view controller are changed to; <ol> <li><i>showViewController: sender:</i> - replacement for all showing view controller methods</li> <li><i>showDetailViewController: sender:</i> - its implimented by split view controller</li></ol>and these are implemented by all custom view controllers as well. <br><br>Previously we used to differentiate orientation with <b>UIInterfaceOrientation</b> and <b>UIUserInterfaceIdiom</b>, in iOS 8 insteed of this there is a new concept of <b>Size Classes</b>. <b>Size Classes</b> have four different variations based on Vertical, Horizontal, Regular and Compact ie; <ol> <li><b>Horizontal Regular</b> - iPad landscape, iPhone portrait</li> <li><b>Horizontal Compact</b> - iPhone landscape</li> <li><b>Vertical Regular</b> - iPad portrait</li> <li><b>Vertical Compact</b> - iPhone portrait, iPhone landscape</li></ol>An iPad have regular size classes only. <br><br> <h2>Traits and Trait collections</h2> <b>Traits</b> are the bunch of properties that we can use to determine how the layout of your application should change as its environment changes. It is consist of following properties; <ul> <li><b>Horizontal size class</b> - Regular / Compact</li> <li><b>Vertical size class</b> - Regular / Compact</li> <li><b>User interface idiom</b> - iPhone / iPad / iPod Touch</li> <li><b>Display scale</b> - 1.0 / 2.0</li></ul>These properties can be "Unspecified" in such case when a UIView is not in the view hierarchy or we have specified a custom Trait Collection. We can also customize the Trait Collection of a child view with <b>Appearance Proxy</b>. <b>Trait Collections (<i>a.k.a UITraitCollection</i>)</b> vended from trait container have both a horizontal and vertical size class trait, it used to describe a collection of traits assigned to an object. <br><br> All these <b>Traits</b> and its values are wrapped in a container i.e; <b>Trait Collections</b>. <b>Trait Environments</b> of a child are inherited from its parent because of this we can access <b>Trait Environments</b> till root from any child. We can get change notification with <i>traitCollectionDidChange:</i> method and override it in UIView and UIViewController subclasses to react to a trait change. <br><br> <b>Trait Environments (<i>a.k.a UITraitEnvironment</i>)</b> is a protocol which provides access to a view collection’s traits (<i>object.traitCollection</i>) and a way to track changes in the trait collection (<i>[object traitCollectionDidChange:]</i>). Its confirmed by most of the objects in view hierarchy i.e; <b>Screen > Window > View Controller(s) > View(s)</b><b>UIViewController</b> adopts traits and the new sizing techniques for adjusting the view controller’s content. <b>Traits</b> are consist of <b>Size Class</b>, <b>Display Scale</b> and <b>Idiom</b> for a particular view object. <b>Size Class</b> coarsely defines the space available and categorizes available space horizontally and vertically. <br><br> <b>Trait Collection</b> are also implemented in <b>UIImage</b> so that we can provide image for any size rather then 1x and 2x versions using <b>Assets Catalog</b>. UIImage view automatically picks the write image based on its <b>Trait Collection</b>, this will be usefull in such case when we need saperate image with respect to varity of size classes. <br><br>We can also add multiple <b>Trait Collection</b> with the help of <i>traitCollectionWithTraitsFromCollections:</i>, on addition the unspecified Traits are filled by the specified and for multiple specified Traits, the last one will be picked. <br><br> <b>UIViewController</b> also have new methods which helps Parent View Controller to override the traits for a child, i.e; <ul> <li><i>-(void)setOverrideTraitCollection: forChildViewController:</i></li> <li><i>-(UITraitCollection *)overrideTraitCollectionForChildViewController:</i></li></ul><br><br> <h2>Split View Controller</h2><b>UISplitViewController</b> is by default collapsed for horizontally compact container (e.g; iPhone, iPod Touch..) otherwise they are expended, the same can be changed further. We can also adjust the % width of both partitions a <b>UISplitViewController</b>. <br><br><i>Good to know:</i> We can also track split view controller expand/collapse with <i>UIViewControllerShowDetailTargetDidChangeNotification</i> in <i>NSNotificationCenter</i><br><br> <h2>Navigation Controller Condensing</h2>There are several awaited features are implimented in <b>UINavigationController</b>, auto and manual toggling nav bar i.e; <ul> <li><i>navController.hideBarOnTap</i> - to enable auto toggle hide/show on tapping</li> <li><i>navController.condensesBarOnSwiped</i> - to enable safari like auto condensing bars</li> <li><i>navController.hidesBarWhenVerticallyCompact</i> - to enable auto hides bar for vertically mode</li> <li><i>navController.condensesBarsWhenKeyboardAppears</i> - to enable auto condensing bars when keyboard appears</li> <li><i>navController.navugationBarCondensed</i> - to manually toggle nav bar</li></ul><br><br> <h2>Presentation Controllers</h2><b>Presentation Controller</b> enhance the exesting API for creating custom presentation, all presentation styles now have an associated <b>Presentation Controller</b> with them. Some new presentation styles are introduced as well, i.e; <ul> <li><b><i>UIModelPresentationOverFullscreen</i></b> - shown like an overlay which means it don't remove the presenting view controller </li> <li><b><i>UIModelPresentationOverCurrentContext</i></b> - cover upon the presenting view controller only</li> <li><b><i>UIModelPresentationPopover</i></b> - it is more like a popover itself</li></ul>Now most of the iPad-only styles are avilable in iPhone as well, some of them are in full screen mode (<i>for iPhone</i>) by default but configurable to be non-full screen. <br><br>Presentation Controllers can easily adapt to size class change. We can use <b>Adaptive Presentations (a.k.a <i>UIAdaptivePresentationControllerDelegate</i>)</b> to track the presentation orientation change. We can create custom presentation controllers which will adapt if <i>shouldPresentInFullscreen</i> returns YES. <br><br> <b>Transition Coordinators (<i>a.k.a UIViewControllerTransitionCoordinator</i>)</b> are part of the UIViewController adaptive UI story. During an active view controller transition, use Transition Coordinator to respond to user cancelation of the transition to run a custom animation or register a completion handler. <b>UIContentContainer</b> can help you to adapt the contents of your view controllers to size and trait changes. New methods are added to it to provide support for Trait, i.e; <ol> <li><i>-(void)willTransictionToTraitCollection:withTransitionCoordinator:</i> - </li> <li><i>-(void)viewWillTransitionToSize:withTransitionCoordinator:</i> - </li></ol> <br><br><b>UIScreen</b> is now interface oriented, which means; <ul> <li><i>-[UIScreen bounds]</i> are interface-oriented</li> <li><i>-[UIScreen applicationFrame]</i> are interface-oriented</li> <li>Status bar frame notification are interface-oriented</li> <li>Keyboard frame notification are interface-oriented</li></ul>To still work in fixed cordinate system we can use protocol <b>UICordinateSpace</b> <br><br><h2>New in Interface Builder</h2><ul> <li>We can use same Storyboard/XIB for any screen size of all iOS devices like iPhone4S, iPhone5, iPad..</li> <li>We can deploy backwards to iOS 6 and iOS 7</li> <li>We can preview devices, orientation and OS versions. Go to <b>Jump Bar</b> > <b>Preview Assistance</b> > <i>Chose plus button from bottom to select device and desired orientation</i></li> <li>We can to use <b>Auto Layout</b> to design flexible UI</li> <li>We can remove or add unique <b>Auto Layout</b> constraints for each screen size</li> <li>We can use <b>Assets Catalog</b> for images to use different versions of same image <i>based on size</i></li> <li>We can override subviews for specific size class</li></ul><br><br> <div style="background:#fafafa; padding:10px;"><h2>Demo Project - </h2><br><a href="https://developer.apple.com/library/prerelease/ios/samplecode/AdaptivePhotos/Introduction/Intro.html">Adaptive Photos - An Adaptive Application</a><br><a href="https://developer.apple.com/library/prerelease/ios/samplecode/AdaptivePhotos/AdaptivePhotosAnAdaptiveApplication.zip">Download Sample Code</a></div> <br /></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/xDfb_T6u0Kg" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com4http://gauravstomar.blogspot.com/2014/06/view-controllers-in-ios-8-quick-review.htmltag:blogger.com,1999:blog-8435031388022811392.post-16701598734292233142014-06-18T00:17:00.000-07:002014-06-18T00:17:49.876-07:00Home Kit Overview<div dir="ltr" style="text-align: left;" trbidi="on"> <b>HomeKit</b> allows your app to communicate with and control connected accessories that support <b>Apple's Home Automation Protocol</b> in a user’s home. To use HomeKit with your iOS apps just switch-on HomeKit in the project editor capabilities panel. <b>HomeKit</b> have a common/central accessories configuration database with read/write access to all apps. <br>We can find and add an new Accessory with <b>Accessory Browser</b> (<i>a.k.a HMAccessoryBrowser</i>). If found we can add the new Accessory to the <b>Home</b>, after that we can assign the same to a <b>Room</b> in that home. <br>We can use <b>HomeKit Accessory Simulator</b> (<i>which act as a real accessory</i>) to test custom made accessories in <b>iOS Simulator</b>. We can open it from <b>Xcode > Open Developer Tool > Home Kit Accessory Simulator</b>. Every accessory come with a setup code to associate it with a Home via <b>HomeKit</b><br><br><b>HomeKit</b> is managed by the <b>Home Manager (<i>a.k.a HMHomeManager</i>)</b>, which provides a pointer to the common database, allowes to manage/create homes and notify the changes. <b>Home (<i>a.k.a HMHome</i>)</b> should have a unque name because its being used by Siri for commands. Home have <b>Roomes (<i>a.k.a HMRoom</i>)</b> in it, (<i>which is also uniquely named for that perticular Home</i>) and Rooms have accessories in them. An <b>Accessory (<i>a.k.a HMAccessory</i>)</b> corresponds to a phycical device (<i>its also uniquely named in its room</i>). <br>We can also group the Rooms in <b>Zones (<i>a.k.a HMZones</i>)</b>, its completely optional and uniquely named with a home. A room can be in any number of zones. Its recognized by Siri. <br><br>Basic steps to setup an accessory are; <ol> <li><b>Create a home</b></li> <li><b>Add rooms to the home</b></li> <li><b>Add accessories</b></li></ol><b>Accessories</b> functionality and characteristics (<i>like temperature, illumination..</i>) are managed by the <b>Services</b> (<i>a.k.a HMService</i>). A Service can be exposed with an unique name/type so that user can trigger the same with Siri. Characteristic (<i>a.k.a HMCharacteristic</i>) of a <b>Services</b> can be read-only, read-write or write-only. <br>Alike Zones, We can also group Services with <b>HMServiceGroup</b><br>We can create <b>Action Sets (<i>a.k.a HMActionSet</i>)</b>, which is a collection of <b>Actions</b> (<i>a.k.a HMCharacteristicWriteAction</i>) that are executed together. Its also uniquely named and recognized by Siri. <br>We can also create timed <b>Triggers</b> (<i>a.k.a HMTimerTrigger</i>) to execute an <b>Action Set</b> that will be fired on an specific date and time or repeatedly. They are managed by iOS itself and executed in background. <br><br>There are many-many delegate methods are exposed by the HomeKit to track each and every change caused by other apps, system or accessories state change. e.g; <ol> <li><b>HMAccessoryBrowserDelegate</b> - to notify a new accessories found or removed</li> <li><b>HMAccessoryDelegate</b> - to notify state change of accessories</li> <li><b>HMHomeDelegate</b> - to notify configuration changes in the home</li> <li><b>HMHomeManagerDelegate</b> - to track changes to a collection of homes</li></ol> <br /></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/Mb5v1e8qQyo" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com0http://gauravstomar.blogspot.com/2014/06/home-kit-overview.htmltag:blogger.com,1999:blog-8435031388022811392.post-20613437549892394932014-06-16T00:29:00.001-07:002014-06-16T00:29:24.330-07:00CloudKit in conciseness<div dir="ltr" style="text-align: left;" trbidi="on"> <b>CloudKit</b> is an API to interact with iCloud Drive, iCloud CoreData and iCloud Photo Library. Its supported on both iOS and OS X. It needs an iCloud account for read/write access because it don't have any persistent memory of its own. CloudKit supports Public and Private databases with both Structured and Bulk data. Key components of the CloudKit are; <ol> <li><b>Containers</b> encapsulates content associated with an app, including both public and private data. It coordinates all interactions between your app and the server. Its exposed as <b>CKContainer</b> object. It can be managed by WWDR portal. Its namespace should be unique like your app identifier.</li> <li><b>Databases</b> - is a channel to access the public and private data of an app container. Every app have two kinda databases, ie; <ul> <li><b>Public Database</b> - It have shared data with read-only anonymous access with data saved on developer quota (i.e; 1 Petabyte)</li> <li><b>Private Database</b> - It have current user's data so it needs an iCloud account for writing and use current user's quota which depends on users iCloud plan</li> </ul> </li> <li><b>Records</b> - is a dictionary of key-value pairs that you use to fetch and save the structured data with just-in-time schema. It can also have a metadata with change tag associated with it. It can save NSString, NSNumber, NSData, NSDate, CLLocation, CKRefrence, CKAsset and An array of all of them</li> <li><b>Record Zones</b> - is a virtual grouping of Records, it can be custom.</li> <li><b>Record Identifiers</b> - uniquely identifies a custom created record zone in a database. They also represents the location of a record.</li> <li><b>References</b> - are the relationship(<i>can be many-to-one</i>) between objects. It is allowed to create circular owning references for a set of records. It supports cascade deletes so its recommended to do Back References.</li> <li><b>Assets</b> - are large files associated with records. Alike Records we can use Asset objects to incorporate huge external files such as images, sound files, video files. Assets are saved as files on iCloud and owned by a Record.</li></ol>To enable the CloudKit in our project we just need to enable the Capabilites -> iCloud -> CloudKit from Project Settings, It expose two kinda APIs, i.e; <ol> <li><b>Operational</b> <i>- in-depth access to CloudKit</i></li> <li><b>Conventional</b> <i>- peaceful for general usage</i></li></ol><br>As other conventional DBs CloudKit also use the queries to fetch data, i.e. <b>CKQuery</b>. Its consist of <b>RecordType</b>, <b>NSPredicate</b> and <b>NSSortDescriptors</b>. <br><br>To save devices resources we can also run our query asynchronously on iCloud server, by using <b>CKSubscription</b>. Its consist of <b>RecordType</b>, <b>NSPredicate</b> and <b>Push</b> (<i>via Apple Push Service</i>) <br><br>CloudKit don't expose user's account details (like email, user name,..) for the sake of privacy. For user mapping iCloud expose stable UUID based on a user and an app Container. An app can ask for permission to the user details. An app can also ask for permission to the user's contacts (<i>have the iCloud account</i>) to enable sharing capabilities. <br><br>App can also use <b>iCloud Key-Value Store</b> for storing (<b>up to 1 MB</b>) configuration data, preferences, and small amounts of app-related data. <br /></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/JbFUXyEvJPY" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com0http://gauravstomar.blogspot.com/2014/06/cloudkit-in-conciseness.htmltag:blogger.com,1999:blog-8435031388022811392.post-64170810303960543822014-06-13T07:33:00.000-07:002014-06-13T07:33:02.284-07:00WebKit API in a nutshell<div dir="ltr" style="text-align: left;" trbidi="on"> <b>WebKit API</b> (<i>for a quick recap, WebKit is a layout and rendring engine for web that's used by Safari, Dashboard, Mail, and many other Apple applications</i>) replaces the traditional UIWebView with WKWebView with lots of powerful features i.e; <ul> <li>Responsive scrolling with 60 frames/sec</li> <li>Power of JS Nitro engion (<i>the engine formerly known as SquirrelFish</i>)</li> <li>Built-in multi gesture</li> <li>App-Web Page communication</li> <li>Automatic Multi-process Architecture - means web view have saperate process alike the app itself</li> <li>Energy efficient</li> <li>It is configurable with WKWebViewConfiguration class</li></ul> Some basic WKWebView features; <ul> <li>Its actions and navigation flow can be easily configurable</li> <li>Its properties can be easily accessable (<i>with <b>KVO</b> as well</i>), e.g; Active page title, URL, estimated progress, etc.</li> <li>With <b>WKNavigationDelegate</b> - its actions can be easily managed same like UIWebView, i.e; app will be notified for url will/did change and page did finish loading</li> <li><b>WKNavigationDelegate</b> can also tell about, navigation type, source frame, destination frame, etc. in a <b>WKNavigationAction</b> object</li> <li><b>WKNavigationResponse</b> is the response object, it also have some useful properties as well</li> <li>Configurable Navigation Gestures for back and forward options</li></ul> Customizing web page content within WKWebView can be done by <b>WKUserContentController</b> which is part of WKWebViewConfiguration. The same can be done by two ways, i.e; <ol> <li>User Sctipts - to take some JS and inject it into the web page, it can executed both start and end of dom loading</li> <li>Script Messages - are the messages that user scripts send back to the app, it can carry JSON as well <ul> <li>To recive <b>Script Messages</b> we need to register <b>WKScriptMessageHandler</b> protocol and messages can be sent by a simple JS call, i.e; <i>window.webkit.messageHandlers.{NAME}.postMessage()</i></li> <li>The recived message is an object of <b>WKScriptMessage</b> with contains; body, webView(<i>reference to the sender web view</i>) and name</li> <li>Web page itself can post the Script Message if their JS are coded to do so</li> <li>We need to be aware of security risks because any JS can call a Script Message</li> </ul></ol><br /></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/O2rEZ9OMlyY" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com0http://gauravstomar.blogspot.com/2014/06/webkit-api-in-nutshell.htmltag:blogger.com,1999:blog-8435031388022811392.post-17009940978654178972014-06-13T05:20:00.000-07:002014-06-13T05:20:34.865-07:00Share Extensions - Recap<div dir="ltr" style="text-align: left;" trbidi="on"> <b>Share Extensions</b> are used to share Audio, Video, Photos, Comments, Links etc, from supported app. In case of web content an app can specify the two types of input i.e; Web URL and Web Page. Web URL is simply the current URL as a string but the Web Page is full HTML of the shared page based on the JS provided by the host app. <br><br>Basic requirments to register an app for sharing; <ol> <li>Display Name - <i>CFBundleDisplayName</i></li> <li>Activition Rules - Inform the iOS about what kind to data they support to share, based on the same iOS will select the app to be shown in sharing menu. App should have appropriate information in "<b>.plist</b>" file @ NSExtension -> NSExtensionAttributes -> NSExtensionActivationRule. There are two ways to supply this information, i.e; <ul> <li>Predicates - A complex or simple predicate with supported types, in this case NSExtensionActivationRule will be string type</li> <li>Condensed - A simple list of supported sharing types, in this case NSExtensionActivationRule will be dictionary type</li> </ul> An app can specify the ammount of data it can take at a time in the activation rules. </li> <li>ViewController - App need to provide a ViewController subclassed with <b>SLComposeServiceViewController</b> which will be displayed at the time of sharing</li></ol><br><br><b>NOTE:</b>For Share Extensions we should use <b>NSURLSession</b> to perform server data transfears the reason being your extension does not live beyond its presentation. <br><br>Basic settings of <a href="https://developer.apple.com/library/prerelease/ios/documentation/Social/Reference/SLComposeServiceViewController_Class/">SLComposeServiceViewController</a>; <ol> <li>PhotoBlogCharacterLimit - for max length of share message size</li> <li>PhotoBlogTmageDataMaxSize - for max image size</li> <li><i>- (BOOL)isContentValid</i> method to return the runtime validation result, return false will disable the Post button</li> <li><i>- (NSArray *)configurationItems</i> Returns configuration items to display in the compose view.</li> <li>AudiencePickerViewController/Delegate need to be implimented for privacy setting (<i>Optional</i>)</li></ol> <br /></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/q8_D2NzbD8U" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com0http://gauravstomar.blogspot.com/2014/06/share-extensions-recap.htmltag:blogger.com,1999:blog-8435031388022811392.post-64524707069079288962014-06-13T03:55:00.000-07:002014-06-13T05:20:50.653-07:00Today Extensions - Widgets at a glance<div dir="ltr" style="text-align: left;" trbidi="on"> <b>Extensions in iOS</b> are delivered as a part of your app in <b>Extension Container</b>. They are purpose built binaries which can be accessed via Apple framework code. They don't provide app to app inter-process communication. <br><br><b>Extension Points</b> are the frameworks exposed to the both Widget and its App to provide an information exchange architecture. Extensions can only communicate with there hosting app. <br><b>Today Extensions</b> also known as <b>Notification Center Extensions</b> or <b>Widgets</b> are view controllers (<i>it follows all lifecycle methods</i>). <br><br>From performance perspective; <ul> <li>Cache fetched data</li> <li>Load cached data for seamless transitions</li> <li>Should complete heavy operations in background</li></ul><br>From layout perspective; <ul> <li>The notification Center itself set frames of the base view</li> <li>Its recommended to use Auto-layout</li> <li>We can resize the widget height based on our needs</li> <li>We can manage the Animations and Transitions while changing view, they will work in parallel of system transitions</li> <li>Widget can receive the size change notifications and perform required changes based on that</li></ul> <br> Basic steps to create a new widget for your app; <ol> <li>In your existing app, "Add a new target"</li> <li>There is a new "Application Extension" option in XCode 6+</li> <li>Select "Today Extension"</li> <li>Create a "UIViewController" attached to storyboard</li> <li><i>Code the content of your view controller just like you code it for your app, this might be any kinda listing or detailed info, whatsoever..</i></li> <li>We can provide widget height in "<i>-(void)awakeFromNib</i>" by setting <span class="prettyprint">[self setPreferredContentSize:---]</span></li> <li>We can use "<i>-(void)widgetPerformUpdateWithCompletionHandler:</i>" to get notified for our widget update and perform essential data update. <i><b>NCWidgetProviding</b> provides mechanism to get informed about widget.</i></li> <li><i>Optionally or Based on app requirement, we can add a link in the widget to our app so that user can see detailed information</i></li> <li>We can access the host app with <b>[self extensionContext]</b>, by using the same we can perform <i>[.. openURL]</i> and open the app with its registered URL scheme (e.g; sampleapp://)</li></ol> <br /></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/kWJ0N1CcBoE" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com0http://gauravstomar.blogspot.com/2014/06/today-extensions-widgets-at-glance.htmltag:blogger.com,1999:blog-8435031388022811392.post-39983302239369438582014-06-13T00:34:00.001-07:002014-06-13T00:36:11.569-07:00Health Kit APIs at a glance<div dir="ltr" style="text-align: left;" trbidi="on"> Health Kit APIs are designed to work with existing Health Apps, with this API app can share statistical analysis (e.g; graphs, trends..), user information etc.. and user can check it from iOS "Health" app <br>With Health Kit API we can create, save and ask for users health and fitness related data which is centrally managed by iOS "Health" app. This can be used for surfacing data from other health app and read/write your own data. There are some basics we need to know to get started with the same; <ol> <li><b>HKUnit</b> - It represents a particular unit that can be accessed in any conversion (eg; Kg, Lb, Gram,..)</li> <li><b>HKQuantity</b> - A double value related to a HKUnit. Note: there will be an excecption if you convert different units (e.g; Kg -> Liter), you can ask for compatibility (<i>isCompatiableWithUnit:</i>) if you are not sure</li> <li><b>HKObjectType</b> - It represents different kind of data that we can store in HealthKit (e.g; Steps, Calories, BMI, Blood Pressure, etc..), it is a superclass for all Health Kit data types, i.e; <ul> <li><b>HKCharactersticType</b> - fixed user info like blood type, date of birth, gender</li> <li><b>HKSampleType</b> - variable user info, it is consist of; <ul> <li><b>HKQuantityType</b> - (for Steps, Calories, etc.)</li> <li><b>HKCategoryType</b> - used to categorize HKQuantityType, its paired with corresponding enum</li> </ul> </li> </ul> HKObjectType is immutable and its properties are read-only. </li></ol> We need <b>HKHealthStore</b> to save data, it is kinda link to the database. It will let you save objects and query for data. Usage of multiple <b>HKHealthStore</b> is not recommended. Its easy to ask for HKCharactersticType info of user because HKHealthStore have direct methods for the same, but for complex info there are queries, i.e; <ol> <li><b>HKQuery</b> - we can use predicates to search for our needs.</li> <li><b>HKObserverQuery</b> - watches for changes in the database, it will called each and every something changed in database related to your query. It supports background delivery.</li> <li><b>HKAnchoredObjectQuery</b> - it will help in paging of data, it is consist of Anchor and Limit. Anchor is a simple starting point. If we set Anchor to zero if will return all data with limit, for no limit we can use constant "HKObjectQueryNoLimit". Complition handler will have a new Anchor which we can use in our next query</li></ol>Once we create a query we can execute it with the help of <b>HKHealthStore</b>, it have method two methods "-(void)executeQuery:(HKQuery *)query;" and "-(void)stopQuery:(HKQuery *)query;". We can call a query only once because its callbacks are invalidated once query is stopped. We only need to stop <b>HKObserverQuery</b> because other query will execute callback method only one time. <br><br> We can use <b>HKStatics</b> to get required quantity data from the query output, we can ask statictics for all kinda data or a particular <b>HKSource</b> data. There are two kinda quantity data, i.e; <ol> <li>Discrete - Min, Max, Average (<i>e.g; user's average weight in a week</i>)</li> <li>Cumulative - Sum (<i>e.g; sum of steps taken in a perticular interval</i>)</li></ol>We can filter statictics with the help of <b>HKStatisticsQuery</b>, it takes options as <b>HKStatisticsOptions</b> and returns <b>HKStatistics</b> object. List of <b>HKStatistics</b> objects can be kept in <b>HKStatisticsCollection</b>, which can be further used based on time intervals. <b>HKStatisticsCollectionQuery</b> is used to fetch usefull info from <b>HKStatisticsCollection</b>, it is consist of Statictics options, Anchor data and interval. <br><br> <h2>Good to know</h2> <ol> <li>We need to activate HealthKit in your project settings</li> <li>We need to ask for authorization to read/write health data saparately for each and every type of info</li> <li>Always check of access authorization because user can manage anytime from outside the app</li> <li>An app can't get status for read access to the user info because of Apple's Privacy Policy</li> <li>We need to localize the units ourself, we can do so with the help of NSMassFormatter, NSLengthFormatter and NSEnergyFormatter</li> </ol> <h2>Sample App</h2> <a href="https://developer.apple.com/library/prerelease/ios/samplecode/Fit/FitStoreandRetrieveHealthKitData.zip">Fit Store and Retrieve Health Kit Data</a> - Sample App is avilabe at Apple developer portal you can download it from <a href="https://developer.apple.com/library/prerelease/ios/samplecode/Fit/FitStoreandRetrieveHealthKitData.zip">here</a>. <br /></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/TeNoj41eKCk" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com0http://gauravstomar.blogspot.com/2014/06/health-kit-apis-at-glance.htmltag:blogger.com,1999:blog-8435031388022811392.post-22881563971430732762014-06-12T22:21:00.000-07:002014-06-12T22:21:10.217-07:00New in Cocoa Touch<div dir="ltr" style="text-align: left;" trbidi="on">With iOS 8 Apple is now providing easy access to there native visual effects (i.e; Condensing Bars, UIBlurEffects, UIVibrancyEffect, etc.)<br>Now notifications will work only for UI, that means if user don't approve the Push Notification the app can still get payload (which can be upto 1kb insteed of 256b). Notification can have action associated with them as well, like a Reply button. Notification can be configured based on user location as well.<br><br>iOS 8 is more about adaptivity in how we design our apps architecture, with its new resizable iOS Simulator and all new features, i.e; <ol><li>Adaptive View Controllers i.e; <ul> <li><b>Adaptive Layout</b> (i.e; Orientation, size and margins). Margins adaptivity can be achived by <b>Layout Guide</b>. Orientation, size adaptivity can be achived by <b>Trait Collection</b>, it is for everything you need to know about layout. <b>Trait Collection</b> is based on <b>Size classes</b>, <b>Display scale</b> and User interface idiom.</li> <li><b>Adaptive View Controller Hierarchies</b> (i.e; Unifyed Code). Split View Controller will be auto managed as Navigation View Controller for iPad and iPhone with enhanced customizability. </li></ul><li><b>Adaptive Presentation</b> (i.e; Popovers, Search results, Alerts etc.) e.g; UIAlertController will replace UIAlertView in iPhone and UIActionSheet in iPad</li><li>Adaptive Text and Tables (i.e; They have also introduces some long awaited features like auto height for table row)</li><li><b>App Extensions</b></li></ol><br /></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/JNSzwodhO_4" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com0http://gauravstomar.blogspot.com/2014/06/new-in-cocoa-touch.htmltag:blogger.com,1999:blog-8435031388022811392.post-73124493373001587352014-06-12T06:47:00.001-07:002014-06-12T06:49:10.941-07:00Internationalisation and Localisation in iOS8+<div dir="ltr" style="text-align: left;" trbidi="on"> <b>Locale</b> is made up of "Language" + [optional script] + "Region" + [optional keywords]. Locale settings are based on user preferences and not a reliable source for other operations, e.g; Getting user's "Physical Location"/"Country of residence" which should be obtained by CoreLocation API. <br><br>Locale settings are auto imposed by iOS itself we don't need to do additional coding for the same until or unless we are't going off-track. For some special cases like if we want to get localized data from server you can access Locale setting to do so. We can also use the same logic which are being used by NSBundle by <span class="prettyprint">+[NSBundle preferredLocalizationsFromArray:(NSArray *)localizationsArray]</span><br><br><b>NSLinguisticTagger</b> can be used for Document linguistice content. <br><br>We can get Locale change notification with <b>NSCurrentLocaleDidChangeNotification</b> and impliment it on the go. There are two kinda prefrences for iOS users to chose localisation based on which App and web sites use the language they support, i.e; <ol> <li>Preferred languages - it determines; <ul> <li>NSBundle</li> <li>NSLocalizedString</li> <li>HTTP header "Accept-Language" in WebKit</li> </ul> </li> <li>Local/Regional preferences - it determines; <ul> <li>NSLocale properties</li> <li>Formatter behaviour</li> <li>NSCalendar</li> </ul> </li></ol> <br><h2>PFB - list of major changes in iOS8+ localisation</h2><ol> <li>New localisation <ul> <li>Hindi</li> <li>Indian English</li> <li>Canadian French</li> <li>Hong Kong Chinese</li> </ul> </li> <li>New keyboards <ul> <li>Bengali</li> <li>Marathi</li> <li>Urdu</li> <li>Indian English</li> <li>Filipino</li> <li>Slovenian</li> </ul> </li> <li>New fonts for various languages</li> <li>Language and region settings <ul> <li>Specify primary language</li> <li>Specify preferred language order</li> <li>Localisation into other non-native languages</li> <li>Specify region format language independently</li> </ul> </li> <li>Lunar calendar support with two new Islamic calendars</li> <li>String encoding detection/conversion for unknown source file with lossy and non-lossy both</li> <li>New formatters with formatting context support, i.e; <ul> <li>NSDateComponentsFormatter - Display duration of time in various languages</li> <li>NSDateIntervalFormatter - Display time-intervals in various languages</li> <li>NSEnergyFormatter - Display energy units (e.g; Calories) in various languages</li> <li>NSLengthFormatter - Display length (e.g; Miles, KM..) in various languages</li> <li>NSMassFormatter - Display mass (e.g; Pound, Kg..) in various languages</li> </ul> </li></ol> <i>Good to knows; Because of multiple keyboard support by iOS8+ we need to manage views based on the keyboard size change.</i><br /></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/SVzGR-sbZw0" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com1http://gauravstomar.blogspot.com/2014/06/internationalisation-and-localisation.htmltag:blogger.com,1999:blog-8435031388022811392.post-83132673229820578082014-06-12T00:38:00.000-07:002014-06-12T00:48:49.945-07:00New features introduced in Apple App Store<div dir="ltr" style="text-align: left;" trbidi="on"><ol><li>Related searches</li><li>Tending Searches</li><li>Editor choice badge in App details</li><li>Preview movie for app</li><li>App bundle where developers can bundle same kinda apps and can sale the bundle saperately</li><li>New iTunes Connect dashboard</li><li>iTunes Analytics for Purchased, Visited, Active Users.. More like Google Play Store</li><li>Apple <b>TestFlight</b> integrated in the iTunes store for Beta Releases of the App</li><li>Now we can distribute app up-to 1000 users for testing with the help of Apple <b>TestFlight</b></li><li>Apple <b>TestFlight</b> can also collect and manage the <b>Crash Reports</b> as well</li></ol> <br /></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/z31XeO3s4BM" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com0http://gauravstomar.blogspot.com/2014/06/new-features-introduced-in-apple-app.htmltag:blogger.com,1999:blog-8435031388022811392.post-40977108019404229682014-06-12T00:33:00.000-07:002014-06-12T00:33:15.636-07:00XCode 6 features highlights<div dir="ltr" style="text-align: left;" trbidi="on"><ol> <li>Single storyboard for all screen sizes iOS devices</li> <li>Size classes for Adaptive UI, Its a nice take. With the help of size classes we can configure screen elements for multiple screen sizes</li> <li>Preview Assistant to check output on multiple screen sizes</li> <li>We can use Playground to check code snippets</li> <li>Launch images can be auto generated</li> <li>Storyboards can be used for mac apps as well</li> <li>Asset Catalog supports more types vectors as well</li> <li>Search enhanced</li> <li>Designing with custom fonts made easy</li> <li>Localisation enhanced and automated (+XLIFF Support), No need to use string files from now.</li> <li>Pseudo localisation can be used to save localisation cost (see if it works for you)</li> <li>Runtime localisation check support</li> <li>Custom controls can be edited live on interface builder with the help of <a href="http://www.weheartswift.com/make-awesome-ui-components-ios-8-using-swift-xcode-6/" target="_blank">IBInspectable and IBDesignable</a></li> <li>Debugging have feature to backtrace the blocks as well</li> <li>Debugging and Profiling for Games enhanced</li> <li>Support for Async Testing with <b>XCTestExpectation</b></li> <li>Performance testing with detailed information and control</li> <li>Instruments are redesigned</li> <li>New <b>Profile Guided Optimisation</b> to optimize your code for runtime performance</li> <li>Xcode Bots to manage responsibility for bugs</li> <li>With <b>View Debugging</b> feature we can inspect element on the go, #RIP <b>Revel App</b></li> <li><b>Debug gauges</b>, to provide at-a-glance information about Network Activity, File Activity and iCloud usage while debugging</li> <li>iOS Simulator got new custom screen size configurations and it allow you to keep data and configuration settings grouped together.</li></ol></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/z8nCHMEW7-Q" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com1http://gauravstomar.blogspot.com/2014/06/xcode-6-features-highlights.htmltag:blogger.com,1999:blog-8435031388022811392.post-29860334874964716232014-06-05T01:15:00.002-07:002014-06-12T00:44:25.327-07:00APIs introduced in iOS 8<div dir="ltr" style="text-align: left;" trbidi="on">iOS 7 was something big for its designers and now its time for developers. Yes, iOS 8 is really huge for developers with all new Swift, Unified Storyboards, Handoff and so forth.<br /> Some new features of iOS can surely change the way we achieve our business logic, like <b>CloudKit and Cordova</b> can do really amazing work together. With <b>App Extensions</b> now its easy to interact with iOS, Some interesting things we can do with <b>App Extensions</b>: <ol><li>Sharing for most of data e.g; <ul> <li>Audio</li> <li>Video</li> <li>Photos</li> <li>Comments</li> <li>Links</li> </ul></li><li>Actions to Transform data</li><li>Photo editing in native iOS App</li><li>Safari extensions to access and manipulate DOM</li><li>Interactive notification center widgets</li><li>Document providers to access additional storage</li><li>Third party keyboards with more languages and input methods</li></ol><br /><b>PFB- A high level idea of new APIs introduced in iOS8;</b><br /><dl><dt>1) <b>CloudKit</b></dt><dd>From iOS8+, user can access there files from third party document providers within an app, CloudKit provides APIs to code the same. It is a network depended <b>Cloud</b> access framework for shared cloud storage. Its classes can't be subclassed. Its synchronous and for asynchronous transfers it relies on NSOperation/GCD. Good to know things before starting with <b>iCloud Drive</b>; <ul> <li>User can access shared files from Finder in Mac</li> <li>We need to use UIDocumentPicker to access iCloud Drive files in iOS because there is no shared storage app in iOS for it</li><li>We can manage Records, Relationships and Queries with <b>CKRecord framework</b> and Assets/Larg data blobs with the help of <b>CKAsset framework</b></li><li>We can use <b>CKSubscription framework</b> to get notified in case of change in cloud with a cute puch notification</li><li>We can access the cloud with the help of Developer Portal</li><li>No need to create user accounts as we can use user's iCloud Account</li><li>Storage is free, but Apple have reserved the access rights for it to prevent misusage</li></ul></dd><dt>2) <b>CoreAuthentication</b></dt><dd>Device owner authentication with/without biometrics (Touch ID - iPhone5S+)</dd><dt>3) <b>HealthKit</b></dt><dd>Access users health related data managed by Apple Health, i.e; Sex, BloodType etc. Access health accessories sensors reports i.e; Body temperature, Heart rate etc. </dd><dt>4) <b>HomeKit</b></dt><dd>It provide support to work with Apple's Home Automation Protocol. It will help you Discover, Communicate and Manage the supported accessories.</dd><dt>5) <b>LocalAuthentication</b></dt><dd>To use Biometrics Authentication (Touch ID - iPhone5S+). It will only tell you if user authenticated successfully or not to take appropriate action. </dd><dt>6) <b>Metal</b></dt><dd>It provides support for GPU-accelerated (Apple A7+) advanced 3D graphics rendering, precompiled shaders, state objects, explicit command scheduling and data-parallel computation workloads. It works efficiently Metal shading language.</dd><dt>7) <b>NotificationsUI</b></dt><dd>Used to create an iOS notification centre widget of an app</dd><dt>8) <b>NetworkExtension</b></dt><dd>Manage virtual private network with IKEv2/IPSec</dd><dt>9) <b>Photos</b></dt><dd>Access/Observe/Manage the shared photo library available in both Swift and Objective C <ul> <li>Direct photo access in native app and iCloud with <b>PHAssetCollection</b></li> <li>Full manual control on native camera and Bracketed Capture with the help of <b>AVCaptureDevice</b></li> </ul></dd><dt>10) <b>PhotosUI</b></dt><dd>Used to create custom view-controller class as an extension which provide a user interface for editing photo or video assets in iOS Photos app.</dd><dt>11) <b>SceneKit</b></dt><dd>Processing and animating 3D vector-based graphics, It can work together with SpriteKit as well</dd><dt>12) <b>WebKit</b></dt><dd>It provides an extended web content rendering support with Java, JavaScript and Media Playback configuration.</dd><dt>13) <b>AVKit</b></dt><dd>Yet another optimised audio video player view-controller</dd><dt>14) <b>CoreAudioKit</b></dt><dd>Manage inter app audio player controls</dd><dt>15) <b>NotificationCenter</b></dt><dd>Both a widget and its containing app can use this API to communicate and specify whether there is content in the widget should display or it should be visible in the Today view or its most recent snapshot is still valid, etc.</dd><dt>16) <b>PushKit</b></dt><dd>---</dd> <i><br /><br />Apple made its admirers quite busy for next few months, cheers folks :)</i> </dl></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/OFy7-Fp69mw" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com2Greater Noida, Uttar Pradesh, India28.4743879 77.50399040000002128.2511134 77.181266900000026 28.6976624 77.826713900000016http://gauravstomar.blogspot.com/2014/06/apis-introduced-in-ios-8.htmltag:blogger.com,1999:blog-8435031388022811392.post-29124070110771110202014-04-03T00:18:00.003-07:002014-04-03T00:18:46.990-07:00Using custom UIFont on the fly<div dir="ltr" style="text-align: left;" trbidi="on">Here is yet another code snippet to add a custom font in UIFonts list without previously adding it in your app.plist file, useful while working with library projects and downloading font on the fly. <br /><pre class="prettyprint"><br /> NSArray *arrFont = @[@"Comic Sans MS.ttf",@"Tahoma.ttf"];<br /> <br /> for (NSString *str in arrFont) {<br /> <br /> NSString *fontPath = [[NSBundle mainBundle] pathForResource:BUNDLE_NAME ofType:@"bundle"];<br /> <br /> NSData *inData = [NSData dataWithContentsOfFile:[fontPath stringByAppendingFormat:@"/%@",str]];<br /> CFErrorRef error;<br /> CGDataProviderRef provider = CGDataProviderCreateWithCFData((__bridge CFDataRef)inData);<br /> CGFontRef font = CGFontCreateWithDataProvider(provider);<br /> <br /> if (! CTFontManagerRegisterGraphicsFont(font, &error)) {<br /> CFStringRef errorDescription = CFErrorCopyDescription(error);<br /> NSLog(@"Failed to load font: %@", errorDescription);<br /> CFRelease(errorDescription);<br /> }<br /> CFRelease(font);<br /> CFRelease(provider);<br /> }<br /></pre></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/K1ycnYKxQ14" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com0http://gauravstomar.blogspot.com/2014/04/using-custom-uifont-on-fly.htmltag:blogger.com,1999:blog-8435031388022811392.post-46886396311022603812013-08-04T01:29:00.001-07:002013-08-04T01:39:55.214-07:00Potential security risks in iOS Apps - Part 1<div dir="ltr" style="text-align: left;" trbidi="on"><i>Few days back Apple developer portal hacked by someone, Do we have a leak in our apps?&nbsp;</i><br /><br />In our busy schedule and tight project deadlines we just want to ignore some basic risks in our app, some people think that Apple environment is close enough to take care of it. Do we are really missing something? yes we are<i>..</i><br /><br />These risk increases when we use WebServices, keep files in application folders and don't forget to remove logs while deploying in public domain. Root cause of security holes are:<br /><br /><br /><table style="width: 100%px;"><tbody><tr><td align="center"><a href="http://1.bp.blogspot.com/-MqQ7H8AMoUs/Uf4QMLK52KI/AAAAAAAASwY/pBVLpu8zlBw/s1600/1375622501_network_sans_security.png" imageanchor="1"><img border="0" src="http://1.bp.blogspot.com/-MqQ7H8AMoUs/Uf4QMLK52KI/AAAAAAAASwY/pBVLpu8zlBw/s1600/1375622501_network_sans_security.png" /></a></td><td align="center"><a href="http://1.bp.blogspot.com/-8y92fA5s1qU/Uf4QMPAhHxI/AAAAAAAASwc/XcBt9bGsjao/s1600/1375622509_document_text_security.png" imageanchor="1"><img border="0" src="http://1.bp.blogspot.com/-8y92fA5s1qU/Uf4QMPAhHxI/AAAAAAAASwc/XcBt9bGsjao/s1600/1375622509_document_text_security.png" /></a></td><td align="center"><a href="http://2.bp.blogspot.com/-EAqTxBh2b5E/Uf4QM60pAkI/AAAAAAAASwo/SkM3wTWv8N0/s1600/1375622516_database_security.png" imageanchor="1"><img border="0" src="http://2.bp.blogspot.com/-EAqTxBh2b5E/Uf4QM60pAkI/AAAAAAAASwo/SkM3wTWv8N0/s1600/1375622516_database_security.png" /></a></td></tr><tr><td align="center" width="33%"><b>WebServices</b></td><td align="center" width="33%"><b>Publicly-Accessible files</b></td><td align="center" width="33%"><b>Insecure database</b></td></tr></tbody></table><br /><br />I am trying to list down basic things that we can keep in mind while coding:<br /><ol><li>Use <span style="color: #0b5394;">NSTemporaryDirectory</span> or <span style="color: #0b5394;">confstr</span>&nbsp;</li><li>Use of higher level APIs like NSFileManager aren't safe enough&nbsp;</li><li><b>Run static analysis tool frequently.</b> It will not give you all possible issues but it can help with some basics.</li><li>Use preprocessor directives to identify the debug environment&nbsp;</li><li>Avoid using NSLog, use some user define macro for logging<br /><i><span style="color: #0b5394;">#ifdef DEBUGING<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #define Log( s, ... ) NSLog( @"<project_name d=""> %@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )<br />#else<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #define Log( s, ... )<br />#endif</project_name></span></i></li><li>Always log with formatted string, passing <b>ID</b> to log can create a potential leak</li><li>Avoid <a href="https://en.wikipedia.org/wiki/Cross-site_scripting" target="_blank">Cross-site scripting</a></li><li>While opening any URL from a web content check if it is a resource path or a link</li><li>Avoid PhoneGap based environment while security is a concern&nbsp;</li><li>Don't trust&nbsp;<a href="http://en.wikipedia.org/wiki/Serialization#Objective-C" target="_blank">document serialization</a>&nbsp;and avoid directly executing from the same&nbsp;</li><li>Be aware of trojan/<a href="http://en.wikipedia.org/wiki/Code_injection" target="_blank">code injection</a>&nbsp;every time you process a&nbsp;downloaded file or&nbsp;file from local directories&nbsp;</li><li>Use&nbsp;<a href="http://en.wikipedia.org/wiki/Hardening_(computing)" target="_blank">hardening</a>&nbsp;techniques</li><li>Be aware of security properties of APIs you use&nbsp;</li></ol><div><br /></div><div>Useful testing stuffs&nbsp;</div><div><ol style="text-align: left;"><li>Unit-Testing is your friend&nbsp;</li><li><a href="http://peachfuzzer.com/v3/Monitors/CrashWrangler.html" target="_blank">Crash Wrangler</a>&nbsp;- <a href="http://en.wikipedia.org/wiki/Fuzz_testing" target="_blank">Fuzzing</a></li><li><a href="https://en.wikipedia.org/wiki/Penetration_test" target="_blank">Penetration testing</a></li></ol></div><div><br /></div></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/pfjoCoePzVc" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.comhttp://gauravstomar.blogspot.com/2013/08/potential-security-risks-in-ios-apps.htmltag:blogger.com,1999:blog-8435031388022811392.post-61572735522630294012013-08-03T23:46:00.000-07:002013-08-03T23:59:50.204-07:00Connecting with iOS<div dir="ltr" style="text-align: left;" trbidi="on"><div>I was just wondering that how to connect with an iPhone, iPod and iPad. The outcome of my research is there are three ways:<br /><table width="100%"><tbody><tr><td align="right"><a href="http://1.bp.blogspot.com/-MCgpQ5DEcTs/Uf35zqPQD6I/AAAAAAAASv4/aOF698eWL2Q/s1600/1375617036_link.png" imageanchor="1" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-MCgpQ5DEcTs/Uf35zqPQD6I/AAAAAAAASv4/aOF698eWL2Q/s1600/1375617036_link.png" /></a></td><td align="left">Dock</td></tr><tr><td align="right"><a href="http://4.bp.blogspot.com/-JLHw76SmO3k/Uf36A78oNSI/AAAAAAAASwE/EhKFGg8pZHs/s1600/1375616913_bluetooth.png" imageanchor="1" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-JLHw76SmO3k/Uf36A78oNSI/AAAAAAAASwE/EhKFGg8pZHs/s1600/1375616913_bluetooth.png" /></a></td><td align="left">Bluetooth</td></tr><tr><td align="right"><a href="http://2.bp.blogspot.com/-GVHYmOfsGJU/Uf36A5Ndf9I/AAAAAAAASwA/43e3eCmLMhA/s1600/1375616920_wifi.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" src="http://2.bp.blogspot.com/-GVHYmOfsGJU/Uf36A5Ndf9I/AAAAAAAASwA/43e3eCmLMhA/s1600/1375616920_wifi.png" /></a></td><td align="left">WiFi</td></tr></tbody></table></div><div><ol style="text-align: left;"></ol><div>An interesting fact is that the antenna for WiFi and Bluetooth is same. To communicate with external accessories there is a <a href="http://developer.apple.com/library/ios/#documentation/ExternalAccessory/Reference/ExternalAccessoryFrameworkReference/_index.html" target="_blank">ExternalAccessoryFramework</a>.<br /><br />The architecture of EAF is quite simple, it have a <b>EAProtocol</b> and each span of communication is known as <b>EASession</b>. NSStream helps to carry payload and for input there is <b>NSInputStream</b> and for output there is <b>NSOutputStream</b><br /><b><br /></b>Other core level frameworks like <b>CoreAudio</b>, <b>CoreLocation</b> etc, are also helpful while communicating with an external accessory because they get notification of route change. While we connect or disconnect iOS via dock, <b>EAAccessory</b>&nbsp;notify the app by <b>NSNotificationCenter</b><br /><br /><ul style="text-align: left;"><li>&nbsp;EAAccessoryDidConnectNotification</li><li>&nbsp;EAAccessoryDidDisconnectNotification</li></ul><br /><b><br /></b><b>Things to keep in mind</b><br /><ol style="text-align: left;"><li>There are no EA events in background we should keep track of application did enter background</li><li>Close your EA session as soon as your work is completed&nbsp;</li><li>Antenna arbitration is there</li><li>Use accessory change notification generously and be prepared for connectivity loss</li></ol></div></div></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/9ihMSlVPUWc" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.comhttp://gauravstomar.blogspot.com/2013/08/connecting-with-ios.htmltag:blogger.com,1999:blog-8435031388022811392.post-49065336186584875472013-08-03T10:30:00.000-07:002013-08-03T11:22:55.913-07:00Web-Services recapitulate <div dir="ltr" style="text-align: left;" trbidi="on"><div dir="ltr" style="text-align: left;" trbidi="on"><i>Now days most of the apps are using WebServices and the good thing is we all know what it is :)</i><br /><br />Just adding some notes from my side on things like SOAP, REST and ......., and what? is there anything else do we have in the name of WebService.. really?<br /><br />Few days ago, a guy who have experience of more then a decade came to me and told me to integrate WebService in an app. I simply asked for WebService summary <i>which I think an usual question while we start working on something</i>. He said to take the reference from an existing website which he pretended that using the same. First I did't get what he wanted to tell but, his steps just gave me heart attack. He just went to <b>Chrome,</b> opened the <b>Website,</b> right clicked for the<b> Inspect element</b>&nbsp;option and while logging in to that website he monitored the <b>Network </b>and said look here is the <b>WebServices</b>&nbsp;just replicate it in your app. <i>After his statement I thought is it worth to ask something anymore?</i><br /><i><br /></i><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-x3JkripIRTc/Uf1Cz9DqmvI/AAAAAAAASvo/9MqHAgMfNcc/s1600/1375570184_shocked.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-x3JkripIRTc/Uf1Cz9DqmvI/AAAAAAAASvo/9MqHAgMfNcc/s1600/1375570184_shocked.png" /></a></div><div style="text-align: center;"><i><br /></i></div><i><br /></i><b>Okey, letz do a quick recap on what we know:</b><br /><br /><ol style="text-align: left;"><li><a href="http://www.charlesproxy.com/download/" target="_blank">Charles</a>,&nbsp;Yet simplest tool to monitor a WebService request from an iOS and Mac environment</li><li>Each and every resource request to an URI is not a WebService.</li><li>One is SOAP and the rest is REST,&nbsp;<i>why do extensive debate</i></li><li>SOAP is XML based definitive object access WebService protocol made for rich guys :)</li><li><a href="http://oauth.net/" target="_blank">OAUTH</a>&nbsp;is a two tear authorization framework, <a href="http://tools.ietf.org/rfc/rfc6749.txt" target="_blank">ie</a>&nbsp;</li></ol><br /><div><b>iOS + WS&nbsp;</b></div><ol style="text-align: left;"><li>Avoid using 3rd party&nbsp;wrappers like ASIHTTP for networking without exploring them</li><li>NSURLRequest + NSURLConnection&nbsp;are not an&nbsp;evil</li><li>Use event driven APIs</li><li><b>Reachability</b> is our friend</li><li>Don't put sync requests on main thread</li><li>Your app UI should reflect network reality&nbsp;</li><li>Be prepared for <b>speed latency</b> and <b>packet loss</b></li><li>Be prepared for <b>no network</b> and <b>host not reachable</b> conditions</li><li>Always code for <b>insecure connection</b>, use end to end security&nbsp;</li><li>Minimize use of network connections, keep in mind that we also have push notifications&nbsp;</li></ol><div><b><br /></b></div><div><b>PHP&nbsp;+ WS</b></div><div><ol style="text-align: left;"><li>Always think above <b>$_POST,</b>&nbsp;<b>$_GET, $_REQUEST, $_FILE</b>&nbsp;they are just to help you&nbsp;</li><li>Use and read headers&nbsp;generously</li><li><b>php://input </b>thats what you need&nbsp;</li><li>Don't forget your buddy "<b><a href="https://en.wikipedia.org/wiki/Internet_media_type" target="_blank">MIME types</a></b>"</li><li>Be prepared for Trojan and Injunction</li><li>PHP is more related to network, explore its low level possibilities</li><li>Take authorization and content distribution seriously</li></ol><div><br /></div><div><b>JS + WS</b></div></div><div><ol style="text-align: left;"><li>Don't misuse client network and resources :|</li><li>Just enjoy with JSON, <i>sometime XML</i> and leave it all for server side :)</li></ol></div><div></div><div></div></div></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/BxSupbk7oN4" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.comhttp://gauravstomar.blogspot.com/2013/08/web-services-recapitulate.htmltag:blogger.com,1999:blog-8435031388022811392.post-62094068240756588692013-08-03T07:19:00.000-07:002013-08-03T11:51:43.294-07:00Hide blog post from listing based on tags<div dir="ltr" style="text-align: left;" trbidi="on"><span style="background-color: black; color: white;">CSS Part</span><br />&lt;b:if cond='data:blog.pageName != &amp;quot;Doodling&amp;quot;'&gt;<br />&amp;lt;style&amp;gt;<br />.just-hide-post{<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>display:none;<br />}<br />&amp;lt;/style&amp;gt;<br />&lt;/b:if&gt;<br /><div>&nbsp;&nbsp;&nbsp;&lt;!- JUST ABOVE YOUR HEADER CLOSURE TAG --&gt;</div><a name='more'></a><br /><div><b><span style="background-color: black; color: white;">Template Part&nbsp;</span></b></div><div><br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;b:if cond='data:post.labels'&gt;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>&lt;b:loop values='data:post.labels' var='label'&gt;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>&lt;b:if cond='data:label.name == &amp;quot;Doodling&amp;quot;'&gt;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp;lt;div class=just-hide-post&amp;gt;<br />&nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;"> </span> &nbsp; &nbsp;&lt;/b:if&gt;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>&lt;/b:loop&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/b:if&gt;<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;!- YOUR POST --&gt;<br /><br /></div><div><div><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="white-space: pre;">&lt;b:if cond='data:post.labels'&gt; &lt;b:loop values='data:post.labels' var='label'&gt; &lt;b:if cond='data:label.name == &amp;quot;Doodling&amp;quot;'&gt; &amp;lt;/div&amp;gt; &lt;/b:if&gt; &lt;/b:loop&gt; &lt;/b:if&gt;</span></div></div><div><span class="Apple-tab-span" style="white-space: pre;"> </span></div><div>&nbsp; &nbsp; &nbsp; &nbsp; </div><div><br /></div></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/yAufz6RE3xU" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.comhttp://gauravstomar.blogspot.com/2013/08/hide-blog-post-from-listing-based-on.htmltag:blogger.com,1999:blog-8435031388022811392.post-22921752973080056192013-07-31T06:02:00.004-07:002013-08-05T00:29:34.187-07:00iOS - Memory Management <div dir="ltr" style="text-align: left;" trbidi="on"><b>Must follow:</b><br /><ol style="text-align: left;"><li>For every <b>alloc, retain, copy</b> you should have a <b>release</b> as soon as you are going to leave it</li><li><b>Avoid using autorelease</b>d objects, You can use autorelease objects but keep in mind that they will not be released until their pool is released</li><li>Always <b>respond to memory warnings</b> and take them seriously&nbsp;</li><li>Stick to <b>Lazy Loading</b>, means defer initialization of an object until the point at which it is necessity.</li><li>Don't release the objects that we don't own. </li><li><b>Reuse</b> your objects instead of declaring new ones, <i>in possible scenarios.</i></li><li>If you are not using same resource repeatedly then avoid methods like [UIImage imageNamed:@""] because these method will increase cache size, a better alternate is [UIImage imageWithContentsOfFile:@""]</li><li>Build custom UITableCell, UICollectionViewCell etc; and reuse them properly</li><li>Override setters properly</li><li><b>Use initWithCapacity</b> <i>when size is known to you</i></li><li>Use delegates carefully, remember to set delegate properties to nil before releasing its owner; otherwise, the object might think that its delegate is still there, and will send a message to an invalid pointer.</li><li><b>Use LLVM/Clang Static Analyser</b> tool. It will catch errors regarding the Objective-C naming conventions and hidden memory leaks when using foundation frameworks </li></ol><b>Good to have:</b><br /><ol><li>Enable <b>Guard Malloc</b></li><li>Enable <b>NSAutoreleaseFreedObjectCheckEnabled</b></li><li>Enable <b>NSZombieEnabled</b></li><li>Enable <b>NSDebugEnabled</b></li></ol><br /><br /><br /><br /></div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/58jF7nS7WRM" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.comhttp://gauravstomar.blogspot.com/2013/07/ios-memory-management.htmltag:blogger.com,1999:blog-8435031388022811392.post-30825805121360978222013-07-16T22:02:00.001-07:002013-07-16T22:10:46.091-07:00गुनाहगारों में आ पहुँचा खतावारों में आ पहुँचा<p dir=ltr>&#2342;&#2351;&#2366;&#2352;&#2375; &#2395;&#2369;&#2361;&#2369;&#2340; &#2331;&#2379;&#2396;&#2366; &#2324;&#2352; &#2350;&#2361;&#2381;&#2326;&#2381;&#2357;&#2366;&#2352;&#2379; &#2350;&#2375;&#2306; &#2310; &#2346;&#2361;&#2369;&#2306;&#2330;&#2366;<br>&#2327;&#2369;&#2344;&#2366;&#2361; &#2318; &#2332;&#2368;&#2360;&#2381;&#2340; &#2325;&#2368; &#2326;&#2366;&#2340;&#2367;&#2352; &#2327;&#2369;&#2344;&#2366;&#2361;&#2327;&#2366;&#2352;&#2379;&#2306; &#2350;&#2375;&#2306; &#2310; &#2346;&#2361;&#2369;&#2306;&#2330;&#2366;<br>&#2350;&#2375;&#2352;&#2375; &#2342;&#2368;&#2352;&#2366; &#2344;&#2366; &#2361;&#2350;&#2342;&#2350; &#2326;&#2370;&#2348; &#2341;&#2375; &#2346;&#2352; &#2351;&#2375; &#2361;&#2325;&#2368;&#2325;&#2340; &#2361;&#2376;<br>&#2360;&#2348;&#2366;&#2348;&#2367;&#2340; &#2360;&#2375; &#2327;&#2369;&#2395;&#2352; &#2325;&#2352; &#2310;&#2332; &#2360;&#2376;&#2351;&#2366;&#2352;&#2379;&#2306; &#2350;&#2375;&#2306; &#2310; &#2346;&#2361;&#2369;&#2306;&#2330;&#2366;<br>&#2327;&#2369;&#2354;&#2367;&#2360;&#2381;&#2340;&#2366;&#2344;&#2379; &#2350;&#2375;&#2306; &#2352;&#2361;&#2340;&#2366; &#2341;&#2366; &#2326;&#2367;&#2395;&#2366; &#2325;&#2375; &#2395;&#2379;&#2352; &#2360;&#2361;&#2340;&#2366; &#2341;&#2366;<br>&#2348;&#2351;&#2366;&#2348;&#2366;&#2344;&#2379; &#2350;&#2375;&#2306; &#2310; &#2346;&#2361;&#2369;&#2306;&#2330;&#2366; &#2395;&#2369;&#2344;&#2369;&#2395;&#2352;&#2379;&#2306; &#2350;&#2375;&#2306; &#2310; &#2346;&#2361;&#2369;&#2306;&#2330;&#2366;<br>&#2360;&#2348;&#2367;&#2360;&#2381;&#2340;&#2366;&#2344;&#2379; &#2325;&#2375; &#2393;&#2357;&#2366;&#2348; &#2310;&#2357;&#2352; &#2344;&#2366;&#2395;&#2367;&#2352; &#2325;&#2354; &#2325;&#2368; &#2348;&#2366;&#2340;&#2375;&#2306; &#2341;&#2368;<br>&#2358;&#2361;&#2352; &#2325;&#2375; &#2395;&#2347;&#2367;&#2395;&#2366; &#2350;&#2375;&#2306; &#2348;&#2375;&#2342;&#2366;&#2352; &#2344;&#2395;&#2366;&#2352;&#2379;&#2306; &#2350;&#2375;&#2306; &#2310; &#2346;&#2361;&#2369;&#2305;&#2330;&#2366;<br>&#2332;&#2379; &#2340;&#2366;&#2354;&#2367;&#2348; &#2361;&#2376;&#2306; &#2360;&#2369;&#2325;&#2370;&#2344; &#2320; &#2332;&#2367;&#2306;&#2342;&#2327;&#2368; &#2313;&#2344;&#2325;&#2379; &#2350;&#2369;&#2348;&#2366;&#2352;&#2367;&#2325; &#2361;&#2379;<br>&#2361;&#2354;&#2366;&#2325;&#2375; &#2332;&#2370;&#2360;&#2381;&#2340;&#2332;&#2370; &#2341;&#2366; &#2350;&#2376; &#2325;&#2368; &#2310;&#2357;&#2366;&#2352;&#2379;&#2306; &#2350;&#2375;&#2306; &#2310; &#2346;&#2361;&#2369;&#2306;&#2330;&#2366; <br>&#2344;&#2395;&#2352; &#2325;&#2379; &#2326;&#2368;&#2352;&#2366; &#2325;&#2352; &#2360;&#2325;&#2340;&#2368; &#2341;&#2368; &#2360;&#2368;&#2350;&#2379;&#2395;&#2352; &#2325;&#2368; &#2340;&#2366;&#2348;&#2366;&#2344;&#2368;<br>&#2344;&#2395;&#2352; &#2346;&#2354;&#2340;&#2368; &#2361;&#2376; &#2332;&#2367;&#2344;&#2350;&#2375; &#2320;&#2360;&#2375; &#2344;&#2395;&#2352;&#2379;&#2306; &#2350;&#2375;&#2306; &#2310; &#2346;&#2361;&#2369;&#2305;&#2330;&#2366;<br>&#2350;&#2376; &#2348;&#2375;&#2327;&#2366;&#2344;&#2366; &#2341;&#2366; &#2351;&#2332;&#2381;&#2342;&#2366; &#2325;&#2375; &#2346;&#2352;&#2367;&#2360;&#2381;&#2340;&#2366;&#2352;&#2379;&#2306; &#2325;&#2368; &#2350;&#2361;&#2398;&#2367;&#2354; &#2350;&#2375;&#2306; <br>&#2394;&#2344;&#2368;&#2350;&#2340; &#2361;&#2376; &#2325;&#2368; &#2311;&#2344;&#2381;&#2360;&#2366;&#2306; &#2325;&#2375; &#2346;&#2352;&#2367;&#2360;&#2381;&#2340;&#2366;&#2352;&#2379;&#2306; &#2350;&#2375;&#2306; &#2310; &#2346;&#2361;&#2369;&#2305;&#2330;&#2366;<br>&#2314;&#2352;&#2370;&#2360;&#2375; &#2395;&#2367;&#2344;&#2381;&#2342;&#2327;&#2368; &#2325;&#2368; &#2344;&#2366;&#2395; &#2346;&#2352;&#2342;&#2366;&#2352;&#2368; &#2325;&#2366; &#2360;&#2380;&#2342;&#2366; &#2341;&#2366; <br>&#2313;&#2352;&#2370;&#2360;&#2375; &#2395;&#2367;&#2344;&#2381;&#2342;&#2327;&#2368; &#2325;&#2375; &#2344;&#2366;&#2395;&#2366; &#2346;&#2352;&#2381;&#2342;&#2366;&#2352;&#2379;&#2306; &#2350;&#2375;&#2306; &#2310; &#2346;&#2361;&#2369;&#2305;&#2330;&#2366;<br>&#2309;&#2327;&#2352; &#2351;&#2361; &#2332;&#2367;&#2306;&#2342;&#2327;&#2368; &#2360;&#2375; &#2346;&#2381;&#2351;&#2366;&#2352; &#2349;&#2368; &#2319;&#2325; &#2395;&#2369;&#2352;&#2381;&#2350; &#2361;&#2376; &#2398;&#2367;&#2352; &#2340;&#2379;<br>&#2327;&#2369;&#2344;&#2366;&#2361;&#2327;&#2366;&#2352;&#2379;&#2306; &#2350;&#2375;&#2306; &#2310; &#2346;&#2361;&#2369;&#2305;&#2330;&#2366; &#2326;&#2340;&#2366;&#2357;&#2366;&#2352;&#2379;&#2306; &#2350;&#2375;&#2306; &#2310; &#2346;&#2361;&#2369;&#2305;&#2330;&#2366;<br>&#2349;&#2335;&#2325;&#2340;&#2366; &#2398;&#2367;&#2352; &#2352;&#2361;&#2366; &#2341;&#2366; &#2342;&#2352;&#2348;&#2342;&#2352; &#2324;&#2352; &#2325;&#2370;&#2348;&#2325;&#2370;&nbsp; &#2340;&#2366;&#2348;&#2366;&#2306;<br>&#2351;&#2361; &#2351;&#2366;&#2352;&#2379;&#2306; &#2325;&#2366; &#2340;&#2360;&#2352;&#2369;&#2398; &#2361;&#2376; &#2325;&#2368; &#2351;&#2366;&#2352;&#2379;&#2306; &#2350;&#2375;&#2306; &#2310; &#2346;&#2361;&#2369;&#2305;&#2330;&#2366;<br>&#2342;&#2351;&#2366;&#2352;&#2375; &#2395;&#2369;&#2361;&#2369;&#2340; &#2331;&#2379;&#2396;&#2366; &#2324;&#2352; &#2350;&#2361;&#2381;&#2326;&#2381;&#2357;&#2366;&#2352;&#2379; &#2350;&#2375;&#2306; &#2310; &#2346;&#2361;&#2369;&#2306;&#2330;&#2366;<br>&#2327;&#2369;&#2344;&#2366;&#2361; &#2318; &#2332;&#2368;&#2360;&#2381;&#2340; &#2325;&#2368; &#2326;&#2366;&#2340;&#2367;&#2352; &#2327;&#2369;&#2344;&#2366;&#2361;&#2327;&#2366;&#2352;&#2379;&#2306; &#2350;&#2375;&#2306; &#2310; &#2346;&#2361;&#2369;&#2306;&#2330;&#2366;<br><br></p><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/SZdiocwT6jM" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com0http://gauravstomar.blogspot.com/2013/07/blog-post.htmltag:blogger.com,1999:blog-8435031388022811392.post-80610813209012069202013-06-18T22:58:00.000-07:002013-06-18T22:58:35.627-07:00Error in Personal frameworks after installing new xcode<div dir="ltr" style="text-align: left;" trbidi="on"><br />I have installed the new xcode version with my last xcode version which made me crazy because my project with some personal frameworks are stopped working :(<br /><br />When I have checked the Framework code it is giving some strange error; "target specifies product type 'com.apple.product-type.framework.static', but there's no such product type for the 'iphoneos' platform"<br /><br />After a long long gooooogling in the dark side which did't help me so much. I have found a simple solution, ie;<br /><br />1) Quit both of XCode versions<br />2) Switch the active XCode version to the last one (in my case it is; sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer)<br />3) Reinstall "iOS Real Static Framework"<br />4) Clean and Build<br /><br /><br />Do get in touch with me in case you wish to discuss this further. Happy Coding ;)</div><img src="//feeds.feedburner.com/~r/GauravSTomarBootstrappingIntelligence/~4/zkOCH3iKtRw" height="1" width="1" alt=""/>Gaurav S Tomarhttps://plus.google.com/113205685662135077398noreply@blogger.com0http://gauravstomar.blogspot.com/2013/06/error-in-personal-frameworks-after.html