Interfacing an ATTiny84 to iPhone from headphone jack
Look into Project HiJack, which establishes 2 way serial connection to the iPhone via the earphone port and harvests power! The source code is open source. 

They use Manchester encoding for modulation, a brief analysis of their code is on my blog.