You can use Apple wireless keyboard with your iPhone 3GS or later. You must pair the wireless keyboard with iPhone through Bluetooth. lets see how to pair wireless keyboard with iPhone using bluetooth.
Connect wireless keyboard with iPhone.
Tap “Settings” icons on iPhone and choose General > Bluetooth.
Tap the “Bluetooth” switch if its OFF already.
Turn ON the Apple wireless keyboard by pressing power button.
Select the keyboard entry under Devices on iPhone.
Disconnect wireless keyboard from iPhone
On iPhone Tap “Settings” icon and choose General > Bluetooth and tap the keyboard entry under Devices and tap “Forget this Device”.