Make Better Things



I like to make better things.

Distribute Enterprise applications Over The Air (OTA)

iOS supports over-the-air installation of enterprise apps, letting you distribute in-house software to your users without using iTunes or iPhone Configuration Utility.

Here are the steps by which you can create OTA distribution for your Enterprise apps.

Step 1: Archive your project as usual and open Organizer.

Step 2: Select the file you want to distribute and press the Share button.

Step 3: Select “iOS App Store Package (.ipa) and press next.

Step 4: A new window will which will ask you to enter the name of the ipa file. There is a check box at the bottom of the screen “Save for Enterprise Distribution”, select this check box.

Step 5: The window will expand to look something like this.

It will ask you few information on where you want to host the file, its icons and title.

Make sure you enter the application URL to the complete url of the file you would host on your server. Then enter title, subtitle, large icon url (512×512) and small icon url (57×57). Once you select the “ok” a .ipa file and .plist file will save in your select folder.

Step 6: Now we need to create a html file which will have the link of the plist file. Here is the sample file -

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>Sushi App</title>
</head>
<body>
  <ul>
    <li><a href="itms-services://?action=download-manifest&url=http://122.160.153.125/sushi_ota_16_05_2012.plist"> Tap Here to Install the Application</a>
  </li>
  </ul>
</body> </html>

Notice the url in form – itms-services://?action=download-manifest&url=http://122.160.153.125/sushi_ota_16_05_2012.ipa
The above is just a sample html which have only the link, you can create more good looking files but just be careful with the link.

Step 7: Now upload .ipa file, .plist file and .html file on the webserver (which you mentioned while saving the ipa file).

Step 8: Open the html file in safari and tap the link to install the app on your device.

Variable number of arguments in Objective-C methods

Ever wondered how the NSString’s +stringWithFormat: method work? How you can pass endless arguments in it?

Well methods that take variable arguments are known as variadic methods.

Here is an example of such a method

Declare variable argument function in your .h file as below

- (void) appendObjects:(id) firstObject, ...; // This method takes a nil-terminated list of objects.

Here is the definition in .m file –

- (void) appendObjects:(id) firstObject, ...
{
     id eachObject;
     va_list argumentList;
     if (firstObject) // The first argument isn't part of the varargs list,
     {
           [self addObject: firstObject];// so we'll handle it separately.
           va_start(argumentList, firstObject); // Start scanning for arguments after firstObject.
           while (eachObject = va_arg(argumentList, id)) // As many times as we can get an argument of type "id"
           {
               [self addObject: eachObject]; // that isn't nil, add it to self's contents.
           }
           va_end(argumentList);

     }

}

iOS development learning resources

Here is a good compilation of links useful in learning iOS development

1) Blogs on iPhone development

http://www.cimgf.com/

http://mycodeteacher.com/

http://iphonedevelopment.blogspot.com/

http://iphoneincubator.com/blog/

http://iphone.zcentric.com/

http://iphoneproghelp.blogspot.com/ (Programming Tutorial)
http://icodeblog.com/ (Programming Tutorial)

http://idevrecipes.com/

2) iPhone Source Code

http://www.theiphonedev.com/SourceCode/tabid/143/Default.aspx

3) Community

http://www.iphonekicks.com/

https://devforums.apple.com/

http://iphonedevsdk.com/

4) News

http://mobileorchard.com/

http://theappleblog.com/

5) Jail breaking/Hacking

http://theiphoneproject.org/

6) Open source libraries and Applications

http://www.codingventures.com/2008/12/useful-open-source-libraries-for-iphone-development/#more-43

http://www.sourcemac.com/

http://www.codeplex.com/

Face Detection: http://niw.at/articles/2009/03/14/using-opencv-on-iphone/en
Bar Code: Is there a barcode recognition framework for iOS?
Rating: http://github.com/eisernWolf/TouchCustoms

http://github.com/erica/iphone-3.0-cookbook-

Is there a gallery of reusable iPhone components on the web?

http://mattgemmell.com/source

http://www.cocoacontrols.com/

http://open.iphonedev.com/

http://www.opensourceresources.org/

http://www.raywenderlich.com/tag/sample-code

Three 20: http://github.com/facebook/three20
Tapku Library: http://github.com/devinross/tapkulibrary

7) Topic-wise
App Store: https://developer.apple.com/appstore/resources/approval/guidelines.html
GIF Support: http://stackoverflow.com/questions/1379818/how-can-i-make-an-animated-gif-with-the-iphone-sdk
In App Purchase: http://www.sixtemia.com/journal/2009/08/12/using-store-kit-framework/
IP Address: http://www.iphonedevsdk.com/forum/iphone-sdk-development/5293-get-current-ip-address.html
Page Curl Animation: What iPhone OS APIs could I use to implement a transition animation similar to the iBook page flip transition?
TTF Font http://github.com/zynga/FontLabel
Rotate Label: http://iphonedevelopment.blogspot.com/2009/12/better-two-finger-rotate-gesture.html
Speech Recognition – 1: http://cmusphinx.sourceforge.net/
Speech Recognition – 2: http://www.politepix.com/openears/
Operation and Thread: http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/
Web service: http://icodeblog.com/2008/11/03/iphone-programming-tutorial-intro-to-soap-web-services/
Code Analyzer: http://clang.llvm.org/StaticAnalysis.html
Game Center: http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-game-center-achievements-and-leaderboards-part-1/
SMS Chat: https://github.com/acani/AcaniChat
Rotating Knob: https://github.com/hollance/MHRotaryKnob

8 ) Game Development with Cocos2D

http://code.google.com/p/cocos2d-iphone/

http://blog.sapusmedia.com/search/label/cocos2d

http://iphonesdkdev.blogspot.com/2009/01/xcode-template-for-cocos2d.html

http://monoclestudios.com/cocos2d_whitepaper.ht

http://lethain.com/entry/2008/oct/03/notes-on-cocos2d-iphone-development/

http://lethain.com/entry/2008/oct/20/touch-detection-in-cocos2d-iphone/

Open GL: http://web.me.com/smaurice/AppleCoder/iPhone_OpenGL/Archive.html

9) Drawing Charts and Graphs

http://code.google.com/p/core-plot/

http://code.google.com/p/s7graphview/

http://github.com/duivesteyn-enterprises/deSimpleChart

http://www.rgraph.net/ (Will work on UIWebView only)
http://sebkade.wordpress.com/2010/05/06/basic-graph-class-for-iphone/ (a blog where demo is given to create a graph)

10) Map Kit

http://github.com/kishikawakatsumi/MapKit-Route-Directions

http://www.iphonedevsdk.com/forum/iphone-sdk-development/8100-opening-maps-app-given-route-direction.html

http://spitzkoff.com/craig/?p=65

11) Audio Streaming

http://code.google.com/p/indie1031/

http://cocoawithlove.com/2010/03/streaming-mp3aac-audio-again.html

http://code.google.com/p/audiostreamer-meta/

http://github.com/DigitalDJ/AudioStreamer

http://lists.apple.com/archives/coreaudio-api/2009/Jan//msg00143.html

https://bitbucket.org/brentsimmons/ngmovieplayer/ (It’s a code for streaming video using     AVPlayer class. Same code could be applied for streaming audio as well by minor modification)

12) Twitter

http://code.google.com/p/tweetphoto-api-objective-c/

http://tweetphoto-api-objective-c.googlecode.com/files/TweetPhoto.zip

13) Scroll View

http://github.com/andreyvit/ScrollingMadness

14) SQLite

http://code.google.com/p/sqlitepersistentobjects/

http://www.slideshare.net/360conferences/using-sqlite

15) Video
How to play YouTube Movie on an iPhone Application when tapped on UITableViewCell?

http://www.iphonedevsdk.com/forum/iphone-sdk-development/41322-convert-image-sequences-video.html

16) SCM

http://iphonedevelopment.blogspot.com/2009/03/version-control-is-your-friend.html

http://developer.apple.com/tools/subversionxcode.html

Which SCM system for Xcode?

http://www.covertapps.com/development/6-setting-up-your-xcode-scm-repositories

17) Testing: Functional Testing

http://www.gorillalogic.com/fonemonkey

Unit Testing:
i) http://code.google.com/p/google-toolbox-for-mac/
ii)http://developer.apple.com/tools/unittest.html
Automated Testing:
i) http://cocoawithlove.com/2008/11/automated-user-interface-testing-on.html
ii)http://code.google.com/p/uispec/
iii) http://answers.oreilly.com/topic/1646-how-to-use-uiautomation-to-create-iphone-ui-tests/

18) Push Notification

http://blog.boxedice.com/2009/07/10/how-to-build-an-apple-push-notification-provider-server-tutorial/

http://urbanairship.com/

19) Core Data Tutorial for Beginners

http://www.raywenderlich.com/934/core-data-tutorial-getting-started

20) VOIP

http://code.google.com/p/idoubs/

http://code.google.com/p/siphon/

http://github.com/pzion/miumiu

http://www.linphone.org/eng/download/git.html

.gitignore for iOS projects

You just started to use git with your iOS projects and wants to know which files you should’t track for version control? Here is a list of files you should’t track which using git –

# Exclude the build directory
build/*

# Exclude temp nibs and swap files
*~.nib
*.swp

# Exclude OS X folder attributes
.DS_Store

# Exclude user-specific XCode 3 and 4 files
*.mode1
*.mode1v3
*.mode2v3
*.perspective
*.perspectivev3
*.pbxuser
*.xcworkspace
xcuserdata

You just need to create a .gitignore file in your project directory and put the above content in that file.

Xcode 4.2 documentation offline install

If you have installed the new Xcode 4.2 (only a 1.6 GB file instead of the former 4GB file), you will notice that documentation does not work properly, actually people have been complaining about it and the solution was to download the documentation from inside Xcode preferences.

But if you are a team of iOS developers and want to download the documentation only once and install it on many machines running Xcode?
Here you are the steps:
1. Download the documentation from Xcode from any machine.
2. Go the download installation (See Figure Below)


3. Copy the “documentation set” files (it is actually packages with a lot of file so it is recommend to zip them).
4. Move them to the same location where you installed Xcode on the other machines
5. Restart Xcode.
6. Done.