AVSystemController to disable iOS System sounds gives not found for architecture i386 error -


i want silent ringer volume. using link - how disable ios system sounds if use code:

- (void) setsystemvolumelevelto:(float)newvolumelevel {     class avsystemcontrollerclass = nsclassfromstring(@"avsystemcontroller");     id avsystemcontrollerinstance = [avsystemcontrollerclass performselector:@selector(sharedavsystemcontroller)];  nsstring *soundcategory = @"ringtone";  nsinvocation *volumeinvocation = [nsinvocation invocationwithmethodsignature:                                   [avsystemcontrollerclass instancemethodsignatureforselector:                                    @selector(setvolumeto:forcategory:)]]; [volumeinvocation settarget:avsystemcontrollerinstance]; [volumeinvocation setselector:@selector(setvolumeto:forcategory:)]; [volumeinvocation setargument:&newvolumelevel atindex:2]; [volumeinvocation setargument:&soundcategory atindex:3]; [volumeinvocation invoke]; 

}

it crashes on

nsinvocation *volumeinvocation = [nsinvocation invocationwithmethodsignature:                                   [avsystemcontrollerclass instancemethodsignatureforselector:                                    @selector(setvolumeto:forcategory:)]]; 

because value returned nil.

and if import framework etc , use code

[[avsystemcontroller sharedavsystemcontroller] setvolumeto:0.0 forcategory:@"ringtone"]; 

it not run giving me following error:

undefined symbols architecture i386:   "_objc_class_$_avsystemcontroller", referenced from:   objc-class-ref in settingsviewcontroller.o ld: symbol(s) not found architecture i386 clang: error: linker command failed exit code 1 (use -v see invocation) 

someone please guide me going wrong.

all have add following lines in first method. using private framework(celestial) have import on runtime.

nsbundle *bundle = [nsbundle bundlewithpath:@"/system/library/privateframeworks/celestial.framework"]; bool success = [bundle load]; 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -