How to use CocoaPods with Swift project

If you already know how to install and use CocoaPods then continue else please first visit my previous blog “How to install CocoaPods in XCode” (for Objective-C).

Using CocoaPods or any Objective C library in Swift is not a big deal. XCode is quite smart and it automatically do this for you. You can also check Apple’s documentation on this Using Swift with Cocoa and Objective-C. Once libraries are added, you only need to use a bridging header between Objective-C and Swift and use the new coding style of Swift for calling those methods. Like [MBProgressHUD show] become MBProgressHUD.show( ) etc. Here I am using the example of MBProgressHUD because it is normally used in most of the projects.

Let’s see how it works:

1. Create a new XCode project and select the language Swift (no need to to this if you already have Swift project).

2. Create a Bridging-Header.h file starting with your project name. like, if my project name is SampleProject, bridging header become: SampleProject-Bridging-Header.h and Put this header at the root directory of your project.

If you are not very sure how to do this, the most simplest way is to add a test objective-c file in your project (remove that later). Xcode will prompt an option to configure bridging. When you press Yes, XCode automatically create the bridging file and put inside root of project directory.

bridging

Added Bridging Header:

bridging-file

3. Setup Pod with your project.

4. Add your Pod libraries inside bridging header file as you were normally using in Objective C project.

pod-files

6.  Now you can access MBProgressHUD methods in your swift like:

        MBProgressHUD.showHUDAddedTo(self.view, animated: true)
        MBProgressHUD.hideAllHUDsForView(self.view, animated:true)

xcode-swift

You can download my SampleProject from git. While reading this if you notice that step5 is missing, then cheers!! you follow this carefully and you understand how it works 🙂

Still facing any issue with Pod? Or want to be in touch with us? Contact us:

Email:  muzammil@triffort.com Skype: muz.iphonedev

Triffort_logo

Triffort Technologies Pvt Ltd
www.triffort.com

Apple WatchKit SDK is now available for developers

Apple today announced that its set of WatchKit development tools with XCode 6.2 (beta) are now available for developers, allowing them to begin creating apps for Apple Watch.

#watch #apple #watchkit

The WatchKit framework (WatchKit.framework) contains the classes that a WatchKit extension uses to manipulate the interface of a Watch app. A Watch app contains one or more interface controllers, each of which can have tables, buttons, sliders, and other types of visual elements. The WatchKit extension uses the classes of this framework to configure those visual elements and to respond to user interactions.
“Apple Watch is most personal device ever, and WatchKit provides the incredible iOS developer community with the tools they need to create exciting new experiences right on your wrist.”
The WatchKit extension contains the code for managing the Watch app’s user interface and responding to user interactions. With those two executables, you can support different types of user interactions on Apple Watch:

  • Your Watch app contains your app’s full user interface. The user launches your app from the home screen and uses the app to view or manipulate data. To get started creating a Watch app, see App Essentials.
  • glance is an optional read-only interface that you use to display the most timely and relevant information from your app. Not all apps need a glance, but having one gives the user a convenient way to access your app’s data. To get started creating a glance interface, see Glance Essentials.
  • Custom notification interfaces let you alter the default interface displayed for recently received local and remote notifications and add custom graphics, content, and formatting. Custom notification interfaces are optional. To get started with creating a custom notification interface, see Notification Essentials.

In addition to sharing these use cases for the Apple Watch, Apple has also created a dedicated Apple Watch site for developers, outlining the difference between full apps, Glances, and actionable notifications, offering download links to the iOS 8.2 beta with WatchKit SDK, and providing design guidelines and templates.

Feel free to send us message for any kind of assistance in developing apps for Apple Watch.

Email:  muzammil@triffort.com Skype: muz.iphonedev

Triffort_logo

Triffort Technologies Pvt Ltd
www.triffort.com

iPhone Resolutions

Yesterday Apple launched two new iPhones and Apple watch. As a developer personally i believe these iPhones looks like a pain for us. You have to manage different resolution size now, as it was painful for Android. But in keynotes they said, there will be no issue with Auto layout settings.

2

So now we have these resolutions (in pixel) :

iPhone 6 Plus (5.5 inch) : 1920-by-1080
iPhone 6 ( 4.7 inch) : 1334-by-750
iPhone 5, 5C, 5S (4 inch) : 1136-by-640
iPhone 4S : 960-by-640
iPhone 4 and below : No need to build app for this.

Now Apple is also accepting iPhone6 and iPhone6+ screen shots on iTunes connect. You can upload video preview also for your app, but for this you have to use Safari and OSX v 10.10 or later.

1What are your thoughts on these new devices?

Wants to be in touch with us?

Email:  muzammil@triffort.com Skype: muz.iphonedev

Triffort_logo

Triffort Technologies Pvt Ltd
www.triffort.com

 

Top 10 reason for iOS App rejection

Apple’s review process is infamous within the independent developer community. With its inconsistent approach to approval and rejection, apparent skirting around the rules for big players, and its notoriously vague rejection reasons. According to a survey 54% developers said it was the most frustrating thing about developing for iOS.

Total Percent of App Rejection
58% : Belongs to top 10 %
48% : Other reasons.

Top 10 reason during ending August 28, 2014

14% More information needed

8% Guideline 2.2: Apps that exhibit bugs will be rejected

6% Did not comply with terms in the Developer Program License Agreement

6% Guideline 10.6 : Apple and our customers place a high value on simple, refined, creative, well thought through interfaces. They take more work but are worth it. Apple sets a high bar. If your user interface is complex or less than very good, it may rejected.

5% Guideline 3.3: Apple with names, descriptions, or screenshot not relevant to the App content and functionality will be rejected.

5% Guideline 22.2 Apps that contain false, fraudulent or misleading representations or use names or icons similar to other Apps will be rejected.

4% Guideline 3.4: App name in iTunes Connect and as displayed on a device should be similar, so as not to cause confusion.

4% Guideline 3.2 : Apps with placeholder text will be rejected.

3% Guideline 3.8 : Developers are responsible for assigning appropriate ratings to their Apps. Inappropriate ratings my be changed/deleted by Apple.

2% Guideline 2.9: App that are “Beta”, “Demo”, “Trial”, or “Test” versions will be rejected.

I hope this will help you while submitting your new iOS App.

Wants to be in touch with us?

Email:  muzammil@triffort.com Skype: muz.iphonedev

Triffort_logo

Triffort Technologies Pvt Ltd
www.triffort.com

 

How to install CocoaPods and setup with your Xcode project

Sometimes we are using many Git libraries inside our app. Like JSONKit, AFNetworking,  MBProgressHUD, EGOTableViewPullRefresh, Facebook-iOS-SDK etc. But it is very boring to build all libraries or if you add the code in your project, it is tough to manage. Also, there are many disadvantages in this:

  • Code that could be somewhere else is stored in your repository, wasting space.
  • Sometimes, it’s hard to get a specific version of a library.
  • There’s no central place where you can see which libraries are available.
  • Finding a new version of a library and updating your project with it is time taking and sometimes, painful.
  • Downloading libraries manually creates a tendency to perhaps make some changes to the downloaded code.
  • Updating is harder.

The most simplest solution is to use CocoaPods.

CocoaPods is the dependency manager for Objective-C projects. It has thousands of libraries and can help you scale your projects elegantly. CocoaPods is built with Ruby and is installable with the default Ruby available on OS X.

Installation:

Before installing Pods make sure you have installed/updated command line tool in your Mac machine. You can check this by opening Xcode, navigating the menu to Xcode > Preferences > Downloads > Components, finding Command Line Tools and select install/update.

command-line-tools

Also, make sure Git is installed in your Mac machine.

Open terminal and run this command:

sudo gem install cocoapods

Enter admin password. This could take a while. After few minutes it will show green message is cocoa pods installed successfully in your mac machine.

If you are getting any error with XCode like developer path is missing. First run this command in terminal: sudo xcode-select -switch /Applications/Xcode.app (or your XCodeName.app)

Hurrah….You successfully installed CocoaPods in your mac machine. Now you can setup Pod with your Xcode project.

How to setup POD for your Xcode project:

1. Open Terminal

2. Change directory to your XCode project root directory (where your ProjectName.xcodeproj file is placed).

3. $ pod setup : (Setting up CocoaPods master repo)

If successful, it shows : Setup completed (read-only access). So, you setup everything. Now Lets do something which is more visible…Yes ! Lets install libraries in your Xcode project.

Steps to add-remove-update libraries in pod:

1. Open Terminal

2. Change directory to your XCode project root directory. If your terminal is already running then no need to do this, as you are already at same path.

3. $ touch podfile

4. $ open -e podfile (This should open a blank text file or you can use: open -a Xcode podfile to open this inside Xcode)

5. Add your library names in that text file. You can add new names (lib name), remove any name or change the version. If you are using CocoaPods 1.0 or above you also have to have a ‘target’ section in your Pod File.

target '<Your Target Name>' 
do 
 pod 'AFNetworking', '~> 3.0' 
 pod 'FBSDKCoreKit'
 pod 'JSONKit'
 pod 'MBProgressHUD'
end

NOTE: Use ( control + ” ) button to add single quote at both end of library name. It should be shown as straight vertical line. Without control button it shall be added as curly single quote which will give error while installation of file.

6. Save and close this text file. Now libraries are setup and you have to install/update it.

7. Go to your terminal again and run this command: $ pod install (to install/update these libraries in pod).

You should see output similar to the following:

Updating spec repo `master’
Installing AFNetworking (3.0)…
Generating support files
After successful downloading/installation of any single library, It will generate ProjectName.xcworkspace in your project root directory. From now use this workspace to open your project. When you open your project work space you will see Pod is also added as another Xcode project with your Xcode project. If you open Pod it will show all libraries.

For your next project your don’t need to install the cocoa pod again in your mac machine just open the terminal and setup the Pod in root directory of your Xcode project and always remember these 3 commands :

  • 1. $ touch podfile
  • 2. $ open -e podfile
  • 3. $ pod install

To update Pod libraries : $ pod update

To check POD version : $ pod –version
To update CocoaPods : $ gem install cocoapods or use sudo at start if getting error “You don’t have write permissions for the /Library/Ruby/Gems/2.0.0 directory.”

How to use Pod with Swift? Follow This.

Still facing any issue with Pod? Or want to be in touch with us? Contact us:

Email:  muzammil@triffort.com Skype: muz.iphonedev

Triffort_logo

Triffort Technologies Pvt Ltd
www.triffort.com

 

 

How to add your app on App Store

Author: Triffort Admin

Introduction:

So you’ve programmed your first iOS app and you want to get it uploaded and submitted to the iTunes store? Well, as I found out, it’s not quite as easy as it sounds. The latest XCode 4.5 development tools from Apple have certainly streamlined the process, but it’s still a daunting task your first time around.

This is a very in-depth topic, and I can’t possibly write a tutorial that will cover 100% of cases or every problem you might come up against. What I can do is give an overview of the entire process so you have an idea where you’re getting stuck; some tips that might help you out on the way; and some pitfalls that kept me searching for days.

Getting Started:

In case it isn’t obvious, you need a paid iOS developer account ($99/year) in order to submit applications, free or otherwise, to the iTunes App Store. Ensure your Apple ID includes up to date information, and that the address is accurate. You will need to verify your address and identification details, usually by way of faxing a passport copy and utility bill. If in doubt, call developer support for your local.

I’m also going to assume you already have an app that’s been tested on the simulator/Device, with no bugs or memory leaks.

Here’s a quick summary of the whole submission process:

  • Create a unique App ID for your app and change your bundle identifier in XCode.
  • Create a secure Distribution Certificate for yourself (if you don’t have)
  • Create a Provisioning Distribution Profile for the app (For App Store)
  • Code-sign your app with the distribution profile
  • Archive/Build it in device mode.

Create an App on iTunes Connect with your metadata and sales information. Most of this occurs within the Provisioning Portal, XCode, Keychain Access utility and iTunes Connect.

  • Either use XCode or Application Loader to upload your build file on iTunes Connect. App review team verifies your app, if everything works fine and they satisfied with your design/app-interface; app will be release for App Store.

Lets describe all tasks in more detail:

Login in your developer account (developer.apple.com) and select iOS

Create A Distribution Certificate

NOTE: Creating Distribution Certificate is one time process. If you already did once and installed the certificate in your XCode, You don’t need to create this again. You only need Provisioning Profile for your new app.

This is a secure certificate stored on your profile, which confirms your developer identity and signs your code. There’s an elaborate version of this process detailed on the Distribution tab of the Provisioning Portal, but the simplified version is:

  • Open up Keychain Access, and turn off OCSP and CRL from the Preferences.
  • From the Keychain Access menu, choose Certificate Assistant -> Request Certificate from Authority.

  • Enter your email address (no CA email needed), choose Saved to Disk and Let me specify key pair information, then Continue
  • Choose key size of 2048 bits, and RSA algorithmContinue.
  • This creates a .CSR file on your desktop.
  • In the Provisioning Portal, choose Certificates -> Distribution -> Add Certificate, and upload the file created.  I have already created (below screen shot), but you have to add at first time.

 

  • It may take a few seconds to approve. In the mean time download and install WWDR intermediate certificate also (just download, double click to install).
  • Refresh the page, and you should be able to download your certificate. Again, install it.

As a final step, open up Keychain Access, highlight your private key that you just installed and select Export Item from the menu. Keep this key safe with a backup somewhere, as without it you won’t be able to submit apps in the event of an OS reinstall or on different systems.

Create An App ID

  • First, you need to create an App ID – a unique identifier for your app. Head over to iOS Provisioning Portal – the link is one the right side once you’ve logged into the iOS Developer site, and choose IDENTIFIERS from the sidebar.

  • Click the add button to create a new app ID. The first description field is just a name for your reference. The bundle identifier is a kind of coded name for your app, usually written as your company domain (in reverse), followed by a dot and the app name. For example

App id description: iFrame App

Bundle ID: com.muzammil.iFrame (i.e. com.companyName.productName)

Now select Provisioning profile section and add new provisioning profile for your created app bundle id.

Download the provisioning profile and double click to install this in your XCode. Make sure it is showing as Valid profile.

Over in X-Code, click Target -> Summary, and change the Identifier to be whatever you decided above (com.whatever). Bundle id should be same that you created in previous step.

I am using com.muzammil.iFrame

Check Code Signing & Build Settings

As a final preparatory step, open up XCode and find Code Signing in the Build Settings area. Ensure that the Release option (for both Project and app Target) has your Distribution Profile selected (the one you installed just now).

Select iOS device as the build scheme, and move on to Archiving.

Archiving Your App

Nearly there! Before you can actually submit your app, you need to create an archive of the whole project – the final set of files that will be uploaded to iTunes Connect. Assuming everything has been done correctly until now, the first step is check you have an Archive scheme to build the release version with.

Click on Edit Schemes from the top-left, and either make sure the Archive one is set to Release, or create one now with the appropriate settings. Using the Auto-Create Schemes function within manage schemes should also create this for you.

Your app build section is completed. Now register this app on iTunes connect.

Create An App On iTunes Connect

iTunes Connect is the commercial side of the app store, which handles the actual sales of your finished app, which countries to sell in, description and screenshots etc. It’s actually quite easy, but there’s a lot of information to be filled out, and it’s at this point that you’ll decide whether to sell the app, give it away, enable iAds to be displayed, enter bank information, and sign any contracts needed for release.

To get started, just head to iTunes Connect and Add a New App. You’ll need to choose the bundle identifier from the drop selection box (the com. whatever name you created earlier).

After login inside iTunes Connect select Manage Your Apps:

From top menu select Add New App:

Now Enter App name, unique SKU number e.g. appName123, select App Language and choose your bundle id.

Source: iTunes Connect Developer Guide

Select availability date and price:

Add version number, copyright and category. Secondary category is for games (optional).

Setting a Rating

In the Rating section, set the rating for your app for the purpose of parental controls on the App Store. All apps are required to have a rating. For each content description, choose the level of frequency that best describes your app. As you mark each selection, the app rating is displayed on the right.

Important: Apps must not contain any obscene, pornographic, offensive or defamatory content or materials of any kind (text, graphics, images, photographs, etc.), or other content or materials that in Apple’s reasonable judgment may be found objectionable.

Entering Metadata

For each field in the Metadata section, enter further descriptions for your app version. Unless specified otherwise, these fields are required. Because users read this description to help them make their purchase decision, it is a key piece of marketing text. For tips on writing an effective app description.

Providing App Review Information

Use the App Review Information section to provide contact; review notes, and demo account information so that the App Review team can review your app. If your app requires specific settings, user registrations, or account information before you submit it to the App Store, be sure to include that information in this section.

If your app delivers streaming video over the cellular network, enter a test stream URL in this field. You can also include general instructions or other relevant information about your app that you think would be useful for the review process.

Providing an End User License Agreement (Optional)

If you want to provide an end user license agreement (EULA) for your app beyond the standard EULA that Apple provides, click the “click here” link in the EULA section.

Uploading Icons, Screenshots, and Routing App Files for Your App

In the Uploads section of this page, you upload all of your assets—specifically, your large app icon for iOS apps, your first screenshot (for iPhone/iPod touch, iPad or OS X), the routing app coverage file, and any additional screenshots. Before uploading your assets, refer to “Creating Assets with the Correct Specifications” to prepare your assets for upload if you have not already done so. All assets, except for the additional screenshots and the routing app coverage file, are required based on the device families set in your app binary.

Ready to Upload Your Binary

After you have completed the app upload preparation steps outlined above, you answer more questions depending on the nature of your binary.

Version Release Control

You can now determine when your app updates go live on the App Store. With version release control, you can specify when a version of your app goes live rather than have the version go live as soon as it is approved by App Review.

As part of your Ready to Upload Binary questions, you are shown the two options for version release control:

If you choose to automatically release your app update, it will go live as soon as it is approved by Apple (pending the availability date you have set).

If you choose to control the version’s release, your app status will change to Pending Developer Release after it has been approved by App Review, indicating that you can release it to the App Store whenever you are ready.

Eventually, your app will be added, and be in the Waiting for Upload status, at which point you can go back to XCode Organizer -> Archives, and hit Distribute to upload. You’ll ask to log in and check which app it is you’re uploading.

Select “Submit to the iOS App Store” option. For Adhoc build you have to select “Save for Enterprise or Ad Hoc Deployment”.

Select application Bundle id and your code signing identity (your distribution profile name).

Click next and it will upload your app on iTunes. After upload done, you can check your itunes connect account. Your app status will display “Upload received” in detail and after few minutes it will show “Waiting for review”. Now you need to just wait for it to be approved – usually a few weeks.

This has been a totally new experience for a fresher or person who just started his career in iOS development. Hopefully you’ve got a clearer understanding of the process now – personally I was a bit daunted by it all and found myself muddling through most of it. Is it as complicated as it sounds? Yes – but only the first time. But once you submitted 2-3 apps you will become master in this and in fairness, it’s this rigorous process that prevents insecure apps and malware from ever making their way onto the app store, so that’s something I’m eternally grateful for.

 

 

 

Like us on FacebookFollow us on TwitterWrite us on: sales@triffort.com

Hire us on Odesk and Elance

Still facing any issue in app submission? For more help contact our expert developer at:

Email:  muzammil@triffort.com Skype: muz.iphonedev

You can also download PDF copy of this tutorial from this link : Triffort_Tutorial

 

Our new app : Classic Board Pro

!! Official Pro release of Classic Board app !!

Classic Board is one the most simplest board app on App Store. It provides you a real time touch experience with Chalk and Duster.

Use stylus pen for best experience. You can also transform your iPhone/iPad screen into a presentation screen.
# Supporting New iPad (Retina) display.
# Supporting iPhone5.
# Option to change chalk color.
# Option to change chalk/duster width.
# 8 beautiful backgrounds that gives a different and classic look to your board.
# 3 nice border styles.
# Share your board via Facebook, Twitter and Email.

Download this pro version and go back in your childhood classroom.

!! Have fun !!

Classic Board

 

Download Classic Board Pro from App Store : https://itunes.apple.com/us/app/classic-board-pro/id568702868?ls=1&mt=8

Error 403 while getFollowers : Twitter iPhone MGTwitterEngine

I was trying to access the followers list from my twitter account by using MGTwitterEngine. But it is giving error. Here is all step what i have done to fixed it.

1. In MGTwitterEngine.m change #define TWITTER_DOMAIN @”twitter.com” To #define TWITTER_DOMAIN @”api.twitter.com/1″

and  #define USE_LIBXML 0 to #define USE_LIBXML 1 (Most of the people are not doing this and getting no response)

2. In your working class.h add #import “MGTwitterEngine.h” and add its delegate <MGTwitterEngineDelegate>

3. In your working class.m add these methods:

#pragma mark TwitterEngineDelegate
– (void) requestSucceeded: (NSString *) requestIdentifier {
NSLog(@”Request %@ succeeded”, requestIdentifier);
}
– (void) requestFailed: (NSString *) requestIdentifier withError: (NSError *) error {
NSLog(@”Request %@ failed with error: %@”, requestIdentifier, error);
}
– (void)statusesReceived:(NSArray *)statuses forRequest:(NSString *)connectionIdentifier {

}
– (void)receivedObject:(NSDictionary *)dictionary forRequest:(NSString *)connectionIdentifier {

NSLog(@”Recieved Object: %@”, dictionary);
}
– (void)directMessagesReceived:(NSArray *)messages forRequest:(NSString *)connectionIdentifier {

NSLog(@”Direct Messages Received: %@”, messages);
}
// This method will call when you received all your followers. I have used one NSMutableArray “friendsList” to store all followers information. You can modify this according to your need.
– (void)userInfoReceived:(NSArray *)userInfo forRequest:(NSString *)connectionIdentifier {

NSLog(@”User Info Received: %@”, userInfo);

friendsList = [[NSMutableArray alloc]init];

for (NSDictionary *u in userInfo ) {

NSDictionary *followersDic = [[NSDictionary alloc]initWithDictionary:u];
[friendsList addObject:followersDic];
[followersDic release];
}
[self.tableView reloadData];
}

This is all what i have added in my class and then calling this method: [[GetAppDelegate() facebook] requestWithGraphPath:@”me/friends” andDelegate:self]; And it return all my followers list.

I hope this code will help to those who have scratching his head from some couple of hours 😉

!! Enjoy !!