#日本語の住所が返ってくるスクリプト
from objc_util import ObjCClass,ObjCInstance,c_void_p,ObjCBlock
import location
location.start_updates()
from time import sleep
sleep(2)
del sleep
currentlocation = location.get_location()
location.stop_updates()
CLLocation = ObjCClass('CLLocation')
clocations = CLLocation.alloc().initWithLatitude_longitude_(currentlocation['latitude'],currentlocation['longitude'])
del location
print(clocations)
NSLocale = ObjCClass('NSLocale')
enlocale = NSLocale.alloc().initWithLocaleIdentifier_('ja_JP')
def completion(_adr, _error):
if _error:
print(_error)
print(ObjCInstance(_error)[0])
print(_adr)
print(ObjCInstance(_adr))
exit('end')
completionHandler = ObjCBlock(completion, restype=c_void_p, argtypes=[c_void_p, c_void_p])
CLGeocoder = ObjCClass('CLGeocoder')
CLGeocoder.alloc().init().reverseGeocodeLocation_preferredLocale_completionHandler_(clocations, enlocale, completionHandler)
CLGeocoder.release()
enlocale.release()
clocations.release()