Home

iOS ARC trap

ARC will release object after block, so if something like AVAudioPlayer, you have to make a class variable to keep it, or else this player object will be release.


Check how many client connected to your internet sharing on your mac

arp -i en1 -a

? (192.168.2.7) at c0:9f:42:8f:88:a2 on bridge0 ifscope [bridge]
? (192.168.2.9) at b0:65:bd:6e:e2:55 on bridge0 ifscope [bridge]
? (192.168.2.255) at ff:ff:ff:ff:ff:ff on bridge0 ifscope [bridge]

Prevent iCloud backup your downloadable content on iOS

Today, I got our company ebook application been rejected AGAIN.

Approving application is a process of really wasting of time, and you need to got result after an week, even don’t know if will pass or not, so let’s learn more experience from the failure.

The reason that this application been rejected is: Item 2.23 in the “Apple Store Review Guidelines” - Should not allow iCloud backup files which is not User generated.

Since it’s ebook application we will download ebook content from server which is called “downloadable” and “not user generated” content. So according to the “iOS Data Storage Guidelines”, we should put those files into “/Library/Caches", although those files will be deleted by iOS system when there is no space. But since it's re-downloadable in your application should has this feature to detect file existence and to re-download the file when the file been deleted.

Our ebook application was persisted files in “/Documents" before, which will be backed up by iCloud automatically everyday, and apple found those files are not user generated so the rejected.

Why the second submission been rejected is: because we set the “Deployment version target” to 4.3 which is not support one important feature “‘do not back up’ attribute” for files, that’s why my solution, which just set attribute for downloaded ebook files as “do not back up”, was rejected again.

Files won’t be backed up only when been placed into:

  1. the application bundle itself
  2. the caches directory
  3. temp directory

So finally we used one solution is:

  1. Set the “Deployment target version” to 5.1 above (5.0 or earlier not support applying file attribute.)
  2. Move the ebook downloading files into “/Library/<Application Support|Custom Dir>"
  3. Apply the “com.apple.MobileBackup” extended attribute to the download folder.

Some references:


Use bower in rails

Bower is a very good tool, it can help you to manage the javascript or css like the way of bundler.

This is what does the config file looks like:

  {
    "dependencies": {
      "jquery": "http://code.jquery.com/jquery-1.8.1.js"
    }
  }

This is the command lines to use the bower.

  $ npm install -g bower
  $ mkdir -p vendor/assets
  $ cd vendor/assets/
  $ curl https://raw.github.com/gist/3667224/component.json > component.json
  $ bower install

jquery page scroll animation

$('html, body').animate({
  scrollTop: $(".top").offset().top
}, 2000);