Something's wrong with my code here and I can't quite figure it out.
Edit: Please correct this code. Thanks!
int stringLength = [theData length];
for (int i = 1; i <= stringLength; i++) {
unichar currentCharacter = [theData characterAtIndex:i];
int currentCharacterCode = keyCodeForKeyString(currentCharacter);
CGPostKeyboardEvent((CGCharCode)0, (CGKeyCode)currentCharacterCode, true);
CGPostKeyboardEvent((CGCharCode)0, (CGKeyCode)currentCharacterCode, false);
}
- (int)keyCodeForKeyString:(unichar)keyString
{
if (strcmp(keyString, "a") == 0) return 0;
if (strcmp(keyString, "s") == 0) return 1;
if (strcmp(keyString, "d") == 0) return 2;
if (strcmp(keyString, "f") == 0) return 3;
if (strcmp(keyString, "h") == 0) return 4;
}