Saturday, November 19, 2011

Photo Streams across iCloud

In Apple Ecosystem iCloud can be used as a transient repository to transfer photos between your IOS devices and your Mac computers.

To a Mac or to an IOS device a Photo Stream is a stream of photos synchronised with photos stored on iCloud.

When you enable Photo Stream on your IOS device the photos you take with your device goes to your Camera Roll Album as well as to Photo Stream Album on your device. Then when your IOS device is connected to Wi-Fi and your Photos application is open (running) the photos will be uploaded from your Photo Stream to iCloud.


You may toggle Photo Stream ON or OFF on your IOS device from Settings/iCloud/Photo Stream or from Settings/Photos. These settings are the same, changing them in one is picked up by the other.



When you enable Photo Stream on your MAC the photos stored on iCloud will be downloaded to iPhoto Stream. The Photo Stream on your Mac is represented like a virtual folder in iPhoto as the following image shows:



This corresponds to Photo Stream Album on your IOS device.

You may toggle Photo Streams ON and OFF on your Mac from System Preferences/iCloud/Photo Stream or from iPhoto Preferences/Photo Stream panel. These settings are the same, changing them in one is picked up by the other.


In time photos will build up on your iCloud taking up space. You may think it is a good way to back up your photos.

Otherwise if you prefer to backup your photos on your Mac (and Time Machine) you may delete photos from iCloud to prevent clutter. But doing so will not delete Photo Stream on your IOS device or on your Mac.

You need to switch Photo Stream option on your IOS device to OFF to delete contents of Photo Stream on your IOS device. With this action the Photo Stream Album in your IOS devices's Photos application is removed. However the photos will still remain under Camera Roll Album.

Similarly you need to switch Photo Stream option to OFF to delete contents of Photo Stream on your Mac. With this action the contents of iPhoto Photo Stream are removed. However the photos will still remain under Library/Photos.

Tuesday, July 12, 2011

Resolving code signing issues

/Developer/Applications/Utilities/Application Loader does not work.

You need to sign and deploy your app from within XCode 4.

  1. Under Project/Code Signing options set Code Signing Identity to your "3rd Party Mac Developer Application:.." certificate.
  2. If you link to static libraries they will be installed into the archive by default and they will cause code verification to fail since they don't have code signing option. To prevent this error open the xcodeproj file of static library and set Build Settings/Deployment/Skip Install to Yes.
  3. Select Product/Archive then Validate and Submit.

Thursday, June 16, 2011

Dealing with Help Viewer cache

It is pain in the neck to deal with Help Viewer cache when developing your Help documents. After updating your indexes with Help Indexer, you may find Help Viewer refusing to open your Help Documents, links do not work, or show empty pages. This happens because more often than not the version number of your help document in the plist is not bumped up.

To fix this problem, I wrote the following bash script to clear several cache repositories Help Viewer and Help Indexer is using.

Create a text file using the text editor pico from the command line:

pico ./hvfix


Edit your text file, then save on exit:

rm -rf ~/Library/Caches/com.apple.help*
rm -rf ~/Library/Preferences/com.apple.help*
rm -rf ~/.Trash/*
killall helpd
defaults write com.apple.helpindexer IndexAnchors YES


Before you run the script make sure to give executable permissions to your script like this

chmod +x hvfix
./hvfix


Then run your script:

./hvfix


This script also automatically sets "Index anchor information in all files" checkbox (which is normally needed for anchor indexing) before you run the Help Indexer next time.

Friday, February 18, 2011

How to detect memory leaks in OS X Applications

In this tutorial I am going to demonstrate how to detect memory leaks in your OS X applications. We are going to use XCode development environment and Instruments tool that comes with XCode.

1.  Put a break point at the end of your application. In this example we have a simple application called Prog1 which we set to deliberately leak memory. Note the commented out line that would cause a 16 byte memory leak:

//[aFraction release]:

Cick to enlarge
2. Run the application in Debug mode and let it stop at the breakpoint.

3. Meanwhile locate the tool called Instruments under Developer/Applications and run it.

4. Select the template called Leaks and press Choose.

Click to enlarge

5. This will bring up a panel with Allocations and Leaks Instruments.

6. Select Leaks instrument by clicking on it.

Click to enlarge

7. Click Target selector on top left and choose the option Attach to Process.

8. From the drop down menu of running processes choose your application by name (eg. Prog1)

9. Press the red Record button on top left. This will start a memory leak detection session.

10. When leaked objects are listed press the red button again to stop.

11. The first line reporting 128 bytes leak is a false alarm it has nothing to do with your application. All Cocoa applications leak 128 bytes. Some argue this is an Apple bug that needs to be fixed.

12. The rest in the listing are your applications' memory leaks. The neat thing is your leaked object's type is given, in this case the class Fraction and how much it leaked.

iTerm2 - How to auto-close sessions and auto-exit when last one closed

 Problem There are two problems when you close sessions and windows in ITerm2. When you gracefully exit from ITerm2 sessions with a recommen...