objective c - Issue with the new iTunes 11.0.3 and ScriptingBridge (specifically the 'playerPosition') -
two or 3 days ago apple introduced new updated itunes: new miniplayer, new player time bar, etc... , thought: "sweet!". found new issue it, , here's problem:
long time ago, created itunes.h
file typing following line in console app
sdef /applications/itunes.app | sdp -fh --basename "itunes"
that's file i've been using retrieve data itunes using scriptingbridge
. now, new update, calling [itunes playerposition]
doesn't work more newest version, (it still works older version). now, nsinteger
calling playerposition
3 (seconds, 0:03) if player position not that.
thought, maybe if generate itunes.h
file again work. , yes, right! works nice [itunes playerposition]
broken on older versions , output 0 (seconds, 0:00).
there way work around works on both older , newer versions?
thank you!
note: if have itunes updated, try downloading significator itunes on mac app store see i'm talking about.
based on information in 2 .h
files going have pay attention version of itunes in order figure out how interpret data coming back. in particular, you'll want check build number in info.plist
in itunes bundle , based on use 1 of 2 class interfaces have built sdp
. suggest take old file , pull out class , rename appended version number, because you're going need cast object pointer before calling method based on version of itunes working with.
so, assuming have itunesobjectproxy
, itunesobjectproxy_old
, use:
double progress; if (newer) progress = [itunes playerposition ]; else progress = (double)[(itunesproxyobject_old *)itunes playerposition ];
that way, make sure double , int handled correctly. obviously, specific names of objects , classes may differ , i'm leaving case of determining version of itunes.app you, that's trivial check of info.plist
.
Comments
Post a Comment