This blog has moved to new location
Please visit : http://www.jeenalinfotech.com/

Parse service will be shutting down


On January 28th, 2016, terrible news for the developer who are using Parse for their app’s back end. They have announced that Parse service and Parse will be fully shutting down next year i.e. January 28th, 2017.

Click here to read more on their official blog.

As parse will be shutting down their service, we need to find the Parse alternatives or have to write our own backend. For individual developer like me, to write the backend for my mobile app and to host on server is not possible. So, I have started out searching for the Parse alternative for my iOS mobile app and I have found the following list on github.

Check out Parse alernatives: https://github.com/milanpanchal/ParseAlternatives

P.S.

Comment out your favourite Parse alternative. 🙂

 

How to disable (ATS) Application Transport Security on Xcode 7


With the launch of iOS 9, Apple added a new level of security for communication of app and its web services. If you are creating any connection using NSURLConnection or NSURLSession in iOS 9 then you will need to use “App transport security (ATS)”, which will reject any insecure connections.

iOS 9 released has “App Transport Security” which encourages developers to use https instead of http.

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app’s Info.plist file.

To ignore all app transport security restrictions, add following key in your app’s Info.plist file.

<key>NSAppTransportSecurity</key>
<dict>
<!--Include to allow all connections (DANGER)-->
<key>NSAllowsArbitraryLoads</key>
      <true/>
</dict>

ATS.png

 

Also, You can add exceptions for specific domains in your Info.plist:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <false/>
    <key>NSExceptionDomains</key>
    <dict>
        <key><!-- your_remote_server.com / localhost --></key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSExceptionRequiresForwardSecrecy</key>
            <true/>
        </dict>
    <!-- add more domain here -->
    </dict>
</dict>
ATS#2.png

P.S.
See Apple’s Info.plist reference for full details

Xcode6: IBDesignable and IBInspectable with Objective-C


With the release of Xcode6, Apple brought some great improvement to interface builder. With new Xcode6 now you can design custom views via Interface builder. You can achieve live rendering of custom views via IB_DESIGNABLE and IBInspectable attributes.

In this blog, I will give you an overview of IB_DESIGNABLE and IBInspectable attributes. So let’s create a demo project and follow the steps.

  • Create new Project (File > New > Project)
  • Select iOS > Application > Single View Application template.
  • Choose a template for new file (File > New > File)
  • Create new Cocoa Touch Class (iOS > Source > Cocoa Touch Class)
  • Give name to to the subclass “SAMCustomView” and subclass to UIView
  • Add IB_DESIGNABLE keyword to above the @interface in header file of the custom view. (In our case its SAMCustomView.h)
  • Add the IBInspectable to the property in the custom view class
  • Now select the Storyboard or XIB file and drag the UIView in Storyboard or XIB
  • Select the added UIView
  • Select the Identity inspector
  • Change Custom class name to SAMCustomView
  • Now select the Attribute Inspector for the added view and see the magic 🙂

Sample code will look like as follow.

#import <UIKit/UIKit.h>

IB_DESIGNABLE

@interface SAMCustomView : UIView

@property (nonatomic) IBInspectable UIColor *startColor;
@property (nonatomic) IBInspectable UIColor *midColor;
@property (nonatomic) IBInspectable UIColor *endColor;
@property (nonatomic) IBInspectable NSInteger borderWidth;
@property (nonatomic) IBInspectable CGFloat cornerRadious;
@property (nonatomic) IBInspectable BOOL isHorizontal;

@end

Screenshot:

screenshot1

Currently, IBInspectable support following types.

  • Int
  • CGFloat
  • Double
  • String
  • Bool
  • CGPoint
  • CGSize
  • CGRect
  • UIColor
  • UIImage

To support older Xcode you just need to add empty macro for IBInspectable, like so:

#ifndef IBInspectable
    #define IBInspectable
#endif

If you found this useful please take a moment to share this with your friends 🙂

Get the source code on github.

what are the alternatives to TestFlight ?


Looking for TestFlight alternatives? Here’s a list of Test Flight Alternatives you can try.

# Name Free/Paid Platform Comments
1 HockeyApp Paid iOS, MAC, Android & Windows Crash reports, Analytics, In-app user feedback. Acquired by microsoft
2 Applause Paid iOS & Android Crash reports, Analytics, In-app user feedback/bug report. Also work after your app will become live.OTA distribution.
3 Appaloosa Paid iOS, Android & Windows Targets enterprise app developers
4 AppBlade Paid iOS, Android & BlackBerry Secure your app beta, encrypt app data, and even completely wipe a tester’s device afterwards.
5 Installr Paid iOS & Android
6 Ubertesters Free & Paid iOS, Android & Windows In-app bug editing, marking, reporting and user feedback. OTA App destribution. Custom Logging.
7 TestFairy Free & Paid iOS & Android Crash reports, Report for CPU, memory, battery,Network, heat maps and more. Video output for bugs. User feedback on shake
8 HockeyKit Free iOS & Android Open source version of HockeyApp
9 Diawi Free iOS & Android Distribute app via link

I recommended to use TestFairyIts very simple to use and provide what all you want.

What is the maximum size of an iOS application?


As of February 12, 2015

The size limit of an app package submitted through iTunes Connect has increased from 2 GB to 4 GB, so you can include more media in your submission and provide a more complete, rich user experience upon installation. Please keep in mind that this change does not affect the cellular network delivery size limit of 100 MB.

This information can be found on Apple news “Now Accepting Larger Binaries“.

What is the best way to remove all subviews from parent view/super view?


While working on project, sometime you encountered a situation where you need to remove all subviews from it superview. To achieve this, you need to follow steps below:

  1. Get all the subviews from its superview by calling subviews method.
  2. Iterator over the all subviews.
  3. Remove subview by calling removeFromSuperview method on it.

In Objective-C:

// Remove all subviews from self.view
    for (UIView *subUIView in self.view.subviews) {
        [subUIView removeFromSuperview];
    }

In Swift:

for subUIView in self.subviews as [UIView] {
    subUIView.removeFromSuperview()
}

Best way to remove all subviews:

If you want to remove all the subviews from its superview, then you can achieve same result as above by writing single line of code.

    [[self.view subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];

For UIView, you can safely use makeObjectsPerformSelector: because the subviews property will return a copy of the array of subviews.

Using makeObjectsPerformSelector method you can remove all the subviews but,  not subviews based on conditions. So If you want to remove some specific subviews then you must have to iterate over all the subviews. Then based on your condition remove those specific subviews.

Consider you want to remove all the UIButton from your superview then my code will look like this.

    for (UIView *subView in self.view.subviews) {
        if ([subView isKindOfClass:[UIButton class]]) { // Condition
            [subView removeFromSuperview];
        }
    }