Thursday, November 24, 2011

automatic reference counting

ARC occupies a middle ground between garbage collection and manual memory management. Like garbage collection, ARC frees the programmer from writing retain/release/autorelease calls........

To read more...

Credit:
http://www.mikeash.com/pyblog/friday-qa-2011-09-30-automatic-reference-counting.html

Tracking Crash Logs

To get the crash logs of the app from various OS:

Credit:
http://iphonedevelopertips.com/debugging/locating-crash-reports.html

http://aplus.rs/apple/how-to-find-crash-logs-for-iphone-applications-on-mac-vista-and-xp/

Installing multiple XCode in mac

How to configure two xCode in the single MAC.

Please follow the steps while Installing xcode other than what you have now.

- Go to Root folder there will be a Developer folder for the existing XCode tool, create new folder with name Developer2
- While installing/configuring new XCode tool, one of the installation page show info about the disk/folder going to install by default. Please change the folder to Developer2
- Just continue other steps.
- That's all, two XCode is ready for development.

Note: Unable to change the default XCode.

Happy Coding.

xcode code analyzer

Clang is the code analyzer, will direct you to fix the dirty code.

You can refer the below links to know better usage.

http://iphonedevelopertips.com/xcode/static-code-analysis-clang-and-xcode-3-2.html

http://clang-analyzer.llvm.org/xcode.html

http://blog.llvm.org/2010/04/amazing-feats-of-clang-error-recovery.html

As of now Clang complier is not available for Xcode 4 (available for Xcode 3.2), it has the default LLVM GCC 4.2 complier. We may get that in future release, to know the error code message better.

Additional:

You must build your code using this Analyzer to fix the potential memory leaks and other issues.

http://clang-analyzer.llvm.org/xcode.html

If you are using,
Xcode 3: Build > Build and Analyze
Xcode 4: Select Product > Analyze.

Building multiple iPhone targets in XCode

This is more helpful now for creating multiple version of same product by only skin change or even lighter change in functionality.

Other case, if we are going to release 'lite' and 'full' version of the same product. We can customize our targets with the required resource based on the release type.

Credit:
http://www.pacificspirit.com/blog/2009/01/27/building_for_multiple_iphone_targets_in_xcode

iOS App Store Package (.ipa) option got disabled after archive

This happens when your build produces more than a single target: say, an app and a library....

Credit:
http://stackoverflow.com/questions/5265292/xcode-4-create-ipa-file-instead-of-xcarchive

Related:
http://iphonedevelopertips.com/xcode/distribute-ad-hoc-applications-over-the-air-ota.html

Tuesday, November 22, 2011

setup svn in mac

Subversion, or “SVN” for short, is a development tool which is a versioned repository for your documents or code. It is allows you to maintain versions of files in an organized manner. Using SVN you can retrieve different versions of documents quite easily. Let’s take a look at how to set it up on Mac OS X Leopard.

  1. Let’s begin by installing SVN. There are a number of ways you can get and install SVN on your Leopard system. The easiest method, the one we will use here, is using XCode. XCode is a set of development tools that ship with your Mac. If you pop in the second DVD that came with your Leopard system, titled “everything else”. You will find the XCode 3 installer on this disk. Double click on it to install. In case you are unable to get your hands on the disc you can also download the XCode 3 installer from Apple’s website. You will, however, need to sign up for the Apple Development Connection program to be able to download XCode 3. The membership is free.
  2. Now let’s do a simple installation of SVN. Remember, this is a basic installation, without a lot of security. I’m assuming here that you are installing this on your machine for only you to use and will not open access to all. To do that you need to add a lot of security, which is beyond the scope of this article.

    Here are steps we are going to follow:

    1. create a local SVN repository
    2. configure the Apache web server to work with SVN
    3. configure Apache to use the repository we created
    4. setup basic authentication for SVN

    1. Let’s create an SVN repository at the location ‘/usr/local/repo’. Launch the Terminal and execute the following command:

      # sudo mkdir /usr/local/repo

      At this point you will be prompted to enter your password. Enter the password you use for the user you are logged in as. Now create a new project called ‘testproject’ in SVN and under the directory we created earlier.

      # sudo svnadmin create /usr/local/repo/testproject

      We need to make sure that the Apache web server can read and write to this repository. So run the following command in the Terminal:

      # sudo chown -R www /usr/local/repo

    2. We now need to configure the Apache web server to work with SVN. Follow the steps carefully, as we are going to be editing the configuration file used by Apache. If done wrong, this can break Apache. Open the Apache configuration file ‘httpd.conf’ in your favorite text editor, for example Vim:

      Scroll down the document till you reach a section where you see a lot of instances of “LoadModule”. Create a new line at the end of this section using the ‘o’ key in Vim, and enter the following:

      # sudo vim /etc/apache2/httpd.conf

      Scroll down the document till you reach a section where you see a lot of instances of “LoadModule”. Create a new line at the end of this section using the ‘o’ key in Vim, and enter the following:

      LoadModule dav_svn_module libexec/apache2/mod_dav_svn.so

    3. Now we will add a separate configuration file for SVN. Scroll down to the end of the document and ad the following line:

      Include /private/etc/apache2/extra/httpd-svn.conf

      Save and exit the file. If you are using Vim then you need to use the following key combination, “ESC + ‘:wq!’ + Enter” to do that. Now open this file using Vim and let’s configure it.

      # sudo vim /private/etc/apache2/extra/httpd-svn.conf

      Enter the following into the file:


      DAV svn
      SVNParentPath /usr/local/repo

      # user authentication
      AuthType Basic
      AuthName “Subversion repository”
      AuthUserFile /etc/users
      # only authenticated users may access the repository
      Require valid-user

    4. Now let’s setup a user for SVN. I’ll create the user calvin and assign him a password. This password protects our Subversion repository.

      # sudo htpasswd -cm /etc/users calvin
      New password:
      Re-type new password:
      Adding password for user calvin

      We’re done now. Hit the url “http://localhost/repo/testproject” in your web browser. You should be prompted for a password here. Enter the username and password you just set. you should be in. You can now create more projects like we created “testproject”.

    Credit: http://www.switchingtomac.com/tutorials/setup-a-subversion-server-on-leopard/

hudson integration for mac

Credits:
  • installing hudson : http://priyanka-tyagi.blogspot.com/2011/01/installing-hudson-on-mac-os-x-snow.html
  • configuring hudson : http://www.manicwave.com/blog/2010/03/01/that-feels-better-cocoa-hudson-and-running-green/
  • auto startup in mac (if req): http://jrenard.info/blog/a-quick-but-working-startup-item-for-hudson-for-mac-os-x.html
  • command line parameter for xcodebuild: http://www.manpagez.com/man/1/xcodebuild/

FTUtils animations

Make use of this FTUtils Animations.

Credit:

http://iphonedevelopertips.com/open-source/ios-open-source-ftutils-core-animation.html

internationalization and localization

Credit:

http://iphonedevelopertips.com/general/resources-for-internationalization-and-localization.html

iOS commenting style

Credit:

http://iphonedevelopertips.com/objective-c/objective-c-comment-styles.html

customize the button with badge in iOS

Credit:

http://www.spaulus.com/2011/04/custombadge-2-0-retina-ready-scalable-light-reflex/?lang=en

Print Preview / Report in iOS


Using libHaru (open source), we can dynamically generate the pdf file with multiple pages for the print report.

Even adding images, drawing lines, and inserting text , etc.

Reference:

https://github.com/bygreencn/iPhonePDF#readme

Any issues in setup libHaru:

http://kishorek.com/2011/05/iphone-libharu-pdf-project-setup-xcode-3-2/

Used in my POC, samples attached.


global ignores

We faced issues in MAC, while committing library.a files.

Here is the solution. We can commit any file or ignore unwanted file by configuring a file.

Follow the steps:

1. Right click finder icon > Goto Folder > type "~/.subversion" > Go
2. Edit the config file (Take backup before editing).
3. Search for this line: # global-ignores = *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.pyc *.pyo *.rej *.a *~ #*# .#* .*.swp .DS_Store *.zip
4. Remove the "*.a" and Save.
5. That's all, now you are ready to commit library files.




Credit:
http://stackoverflow.com/questions/2394363/svn-wont-import-a-library