ios - Objective C method not working properly inside objective C++ -
i'm calling objective c method in objective c++ class create label hiding status bar status bar hiding fine while label not getting created , shown! if call method anywhere else other objective c++ class works fine without issue
the objective c++ class below
void audioroutechangelistenercallback (void *inuserdata, audiosessionpropertyid inpropertyid, uint32 inpropertyvaluesize, const void *inpropertyvalue ) { // ensure callback invoked route change if (inpropertyid != kaudiosessionproperty_audioroutechange) return; { // determines reason route change, ensure not // because of category change. cfdictionaryref routechangedictionary = (cfdictionaryref)inpropertyvalue; cfnumberref routechangereasonref = (cfnumberref)cfdictionarygetvalue (routechangedictionary, cfstr (kaudiosession_audioroutechangekey_reason) ); sint32 routechangereason; cfnumbergetvalue (routechangereasonref, kcfnumbersint32type, &routechangereason); if (routechangereason == kaudiosessionroutechangereason_olddeviceunavailable) { //handle headset unplugged nslog(@"pluggedout"); } else if (routechangereason == kaudiosessionroutechangereason_newdeviceavailable) { //handle headset plugged in nslog(@"something plugged in"); audiotest *test = [[audiotest alloc] init]; armorcontroller *armorcontroller =[[armorcontroller alloc]init]; nslog(@"%d", [test checkheadphonestatus]); if([test checkheadphonestatus] == 1) { [armorcontroller deviceconnectedalert]; } else if([test checkheadphonestatus] == 0) { nslog(@"device not connected"); } } }
the objective c method not executing inside objective c++ class below
- (void) deviceconnectedalert { [[uiapplication sharedapplication] setstatusbarhidden:yes withanimation:uistatusbaranimationfade]; self.titlelabel = [[uilabel alloc] initwithframe:cgrectmake(20, 20, 320, 30)]; [self.titlelabel settext:@"device connected successfully!"]; self.titlelabel.backgroundcolor =[uicolor redcolor]; [self.view addsubview:self.titlelabel]; }
Comments
Post a Comment