ios - iOS 7在内部称为振动(已更改!)?

标签 ios jailbreak iphone-vibrate

根据Are there APIs for custom vibrations in iOS?(从iOS 5/6开始),内部将AudioServicesPlaySystemSoundWithVibration()用于iOS上的振动。

但是我尝试使用MobileSubstrate挂接到iOS 7,
AudioServicesPlaySystemSoundWithVibration <-似乎从未被调用
AudioServicesPlaySystemSound <-切换静音开关但没有其他振动时调用
AudioServicesPlayAlertSound <-似乎从未被调用

所以问题是,从iOS 7开始,内部使用了什么功能(大概仍在AudioToolkit.framework中,但也许没有)?

最佳答案

最近,我研究了当您切换静音开关或连接电源时,SpringBoard如何发挥振动。它仅使用带有相同参数的AudioServicesPlaySystemSound(0x452用于充电,0x453用于静默开关)无声开关。添加公告后,我唯一看到AudioServicesPlaySystemSoundWithVibration调用的地方。

这适用于iOS 5-7。唯一的区别是iOS 5公告使用AudioServicesPlaySoundWithBehavior,因为AudioServicesPlaySystemSoundWithVibration仅在iOS 6开始可用。

更新

首选项应用程序使用0x547或0x546作为参数的AudioServicesPlaySystemSound。使用MobileSubstrate看不到它的原因是,“首选项”应用程序在运行时使用AudioToolbox加载了dlopen框架,然后使用AudioServicesPlaySystemSound获取指向dlsym的指针。在这种情况下,要挂接函数,您需要等到“首选项”应用程序获得指针后再挂接它。

更新2

SpringBoard还使用CoreMedia.framework API来播放振动。这里的所有论据只是从反汇编中得出的猜测。我对C结构参数和浮点指令没有太多经验。

  • FigVibratorPlayVibrationWithDictionary(CFDictionaryRef pattern, BOOL, float)。最后两个参数对我来说是未知的-它们设置为NO和1.0f。
  • FigVibratorPlayVibration(float, CMTime, CMTime, CTime)

  • 上面的功能最有可能被iOS使用,但是还有其他一些功能值得一提:
  • FigVibratorStartOneShot(float, CMTime)
  • FigVibratorStartRepeating。第一个参数可能是浮点数,但其他参数不知道-它是一些CMTime参数。
  • 关于ios - iOS 7在内部称为振动(已更改!)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23642902/

    相关文章:

    iOS 如何在 Sprite Kit 游戏中创建音频淡入/淡出效果?

    iphone - 如何使方法更改 Root View

    ios - libc++abi.dylib : terminating with uncaught exception of type NSException (CollectionView)

    ios - 当我点击一个按钮时,如何让我的 iPhone 振动两次?

    ios - 在录音应用程序中执行振动

    ios - 多个 dispatch_after 不能很好地工作

    ios - iOS App 的根权限

    iphone - 如何在 PC 上重启越狱的 iPhone

    objective-c - 如何检索连接的蓝牙设备的序列号?

    ios - 如何添加标签值以等待命令?