ios - Setting NSObject to nil hangs my app -
i trying transition 1 view controller when user presses cancel button. before call dismissviewcontroller, setting object nil.
this object manager controlling multipeer connection , state associated it. when set nil: _appdelegate.manager = nil;
app hangs 5 seconds, , works again. i've used profiler , nothing happening in cpu or memory. i'm confused. possible has fact multipeer using other threads?
this header file connectionmanager if helpful.
@interface connectionmanager : nsobject <mcsessiondelegate, mcnearbyservicebrowserdelegate, mcnearbyserviceadvertiserdelegate> @property (nonatomic, strong) mcpeerid *peerid; @property (nonatomic, strong) mcnearbyservicebrowser *browser; @property (nonatomic, strong) mcnearbyserviceadvertiser *advertiser; @property (nonatomic, strong) mcsession *session; @property (nonatomic, strong) nsmutabledictionary *sessions; @property (nonatomic, assign) bool leader; @property (nonatomic, strong) nsmutablearray *currentrequestingpeers; @property (nonatomic, strong) nsmutabledictionary *allmessages; @property (nonatomic, strong) nsstring *userid; @property (nonatomic, strong) nsdata *leaderspublickey; @property (nonatomic, strong) nsstring *password; @property (nonatomic, strong) nsstring *nameofprotest; @property (nonatomic, strong) nsmutabledictionary *foundprotests; - (void)joinprotest:(nsstring*)protestname password:(nsstring*)password; - (void)startprotest:(nsstring*)name password:(nsstring*)password; - (void)prunetree; - (void)sendmessage:(nsstring*)message; - (void)searchforprotests; - (void)reset; - (void)testmessagesending; @end
this general debugging tip (posted answer because doesn't work comment).
my guess portion of shutdown procedure waiting response network, , lacking response, times out after 5 seconds. if you're lucky, portion of code involved, recognize waiting network event.
to find out, run app debugger. when app hangs, press pause button. open debug navigator, , examine state of each thread. specifically, click on each line of user code (with blue icon) , see code doing in each thread.
Comments
Post a Comment