objective c - how to solve (__bridge CFURLRef) so it compiles with xcode 3.1 -
i try code work coded xcode 4.1. target system osx 10.5 xcode 3.1. while compiling property issues come up, i'm able handle. following code, don't know how solve clever.
the compiler said: '__bridge'
undeclared (first use in function)
a) know macro, want know if can erase phrase (__bridge cfurlref)
?
b) there more clever solution, have learn?
c) knowledge: __bridge
exactly, between bridge?
static bool willstartatlogin() { nsurl *appurl = [nsurl fileurlwithpath:[[nsbundle mainbundle] bundlepath]]; bool found = no; lssharedfilelistref items = lssharedfilelistcreate(null, klssharedfilelistsessionloginitems, null); if (items) { uint32 seed; cfarrayref itemsarray = lssharedfilelistcopysnapshot(items, &seed); cfindex count = cfarraygetcount(itemsarray); (cfindex = 0; < count; i++) { lssharedfilelistitemref = (lssharedfilelistitemref)cfarraygetvalueatindex(itemsarray, i); cfurlref url = null; osstatus err = lssharedfilelistitemresolve(a, klssharedfilelistnouserinteraction | klssharedfilelistdonotmountvolumes, &url, null); if (err == noerr) { // here follows problematic part found = cfequal(url, (__bridge cfurlref)appurl); cfrelease(url); if (found) { break; } } } cfrelease(items); } return found; }
edit
after @catfish_man 's answer, id know how code without arc, hard work implement missing memory management in modern code!
edit2
little search found out there library solves backward compatibility compiling code on modern systems older os without arc. seen here: https://github.com/plausiblelabs/plweakcompatibility
there equivalent can compiling such code on older 32bit os?
this code using automatic reference counting. need rewrite memory management in entire codebase, , turn off arc, target older oss.
Comments
Post a Comment