iphone - Safely call method of later UIViewController from GCD of object init -


thanks lock nsmutablearray of object not rest of object when using gcd have user object populates array of locations via gcd @ init in hope time modally locationviewcontroller locations present in user.locations (where user passed along viewcontrollers), if aren't there display 'loading...' in picker.

i ideally force refresh within gcd of user in dispatch_sync method. can added method locationviewcontroller refresh picker etc i'm not sure how safely access this.

my first thought in locationviewcontroller if locations aren't there (i.e. nil) set reference locationviewcontroller in user. within dispatch_sync call method [loccont mymethod] if loccont isnt nil. i'm not sure how set property in user class?

@property (strong, nonatomic) locationsviewcontroller * loccont; 

what worries me user can @ anypoint logout , return root view. i'll set

user.loccont = nil 

will arc sort hungover memory nicely?

my other concern happen if don't choose set location , on later view. guess handle setting user.loccont nil in prepareforsegue.

is there better way locationsviewcontroller refresh if user has got there?

i suggest use notifications avoid strong connection between "user" object , view controller.

the locationviewcontroller register custom notification in init method , unregister in dealloc.

the gcd code "posts" notification when finished. causes listeners notified, locationviewcontroller can refresh view.

see nsnotificationcenter documentation, , send , receive messages through nsnotificationcenter in objective-c? sample code should start.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -