ios開発でemojiのサポート判定、有効無効の操作方法

1.絵文字をサポートするかどうかを判断
– (BOOL)supportEmoji
{
BOOL hasEmoji = NO;
#define kPreferencesPlistPath @"/private/var/mobile/Library/Preferences/com.apple.Preferences.plist"
NSDictionary *plistDict = [[NSDictionary alloc] initWithContentsOfFile:kPreferencesPlistPath];
NSNumber *emojiValue = [plistDict objectForKey:@"KeyboardEmojiEverywhere"]; if (emojiValue)
hasEmoji = YES;
else
hasEmoji = NO;
[plistDict release];

return hasEmoji;
}

2.有効または無効
– (void)valueControl:(BOOL)open
{
#define kPreferencesPlistPath @"/private/var/mobile/Library/Preferences/com.apple.Preferences.plist"
NSMutableDictionary* plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:kPreferencesPlistPath];
[plistDict setValue:[NSNumber numberWithBool:open] forKey:@"KeyboardEmojiEverywhere"];
[plistDict writeToFile:kPreferencesPlistPath atomically:NO];
[plistDict release];
}

IOS

Posted by arkgame