Still new to this, but im trying the best i can :-) Right now i've ran into a wall though...
I'm trying to make the phone vibrate by the click of a button.
- I've added the AudioToolbox-framework and imported it.
- I've connected my button to the method
- The button triggers the alert im making in the very same method
- The vibration is completely ignored
- The app doesnt crash - it just doesnt vibrate >.<
Any idea why? I've tried on several phones (All 4's with iOS 4.1):
Yeah I noticed, after this thread I found a place to use vibration in the app I'm working on
But I can't test it at the moment, I had to download SDK 4.1 *sigh*, downloading @ work place is NOT going fast! In 60 minutes I can test it and will tell you by then if it worked at my project or not!
Heh, wish I could help though bud. Not sure why it isn't working. Are you definitely trying on a phone and not an iPod? Heard that iPod doesn't vibrate.
Documentation suggests what you have wrote is correct. I'll have a dig around.
Heh, wish I could help though bud. Not sure why it isn't working. Are you definitely trying on a phone and not an iPod? Heard that iPod doesn't vibrate.
Documentation suggests what you have wrote is correct. I'll have a dig around.
Yeah, im pretty sure that my phone is an iPhone 4 It's happy to vibrate on incomming calls, so it isnt because the vibrator is broken either, hehe.
Yeah, I've had a look. The libraries are showing up red so think something has gone wrong with the import. Delete the Red libraries and then add them again by pressing 'applekey + I Key' on Targets -> HelloItaly and then pressing + and add AudioToolbox + AVFoundation + CoreMotion + CoreLocation.
Yeah, I've had a look. The libraries are showing up red so think something has gone wrong with the import. Delete the Red libraries and then add them again by pressing 'applekey + I Key' on Targets -> HelloItaly and then pressing + and add AudioToolbox + AVFoundation + CoreMotion + CoreLocation.
I think its because im using xcode 4, inthere they seem fine. If i open the project in xcode 3, they're red, even the UIKit, Foundation and CoreGraphics are red >.<
And i cant seem to add AVFoundation, CoreMotion or CoreLocation; they arent listed...
Anyways, wouldnt it fail to compile if it cannot find the framework?
It is fine in xCode 4 and in your code if it is in the viewDidLoad method. For some reason it doesn't like it coming off the IBAction which I can't figure out. I've tried all sorts of different perform selector methods to trick it.
Really not sure on this one. Anyone have any ideas why vibrate would work on viewDidLoad but not in an IBAction method (that is definitely being called).
Is it possible that the vibration "sound" is queued up properly, but showing the alert causes all pending sounds to be canceled? According to to docs, AudioServicesPlaySystemSound() does not allow simultaneous playback of multiple sounds, so perhaps showing the alert causes the vibration sound to get stomped by... something else. Try playing the vibration after you show the alert and see what happens.
Is it possible that the vibration "sound" is queued up properly, but showing the alert causes all pending sounds to be canceled? According to to docs, AudioServicesPlaySystemSound() does not allow simultaneous playback of multiple sounds, so perhaps showing the alert causes the vibration sound to get stomped by... something else. Try playing the vibration after you show the alert and see what happens.
I've tried moving it to the viewDidLoad, and it vibrates just fine... Then i tried to put the vibration in a void method and calling that from my IBOutlet: