I would imagine that Uber has some special permissions or uses some private API that allow them to achieve this behavior without using local notifications. While I don't know how Uber implemented this in their partner app, I can talk a little bit about how alerts work on the home screen.
SpringBoard is the singleton class that manages the SpringBoard application (SpringBoard.app), the application launcher for the iPhone. SpringBoard doesn't use the standard UIAlertView
/UIAlertController
classes, since they don't participate in the SpringBoard-wide alert system. iOS 5 introduced SBAlertItem
the which is used to display UIAlertViews on SpringBoard (Battery Notification Alerts, Sim Unlock Alert, etc.). Apple uses SBAlertItem
for their lock and home screen alerts, I'll be working on the assumption that Uber is using an SBAlertItem
for this answer.
SBAlertItem
has a protected ivar UIAlertView *_alertSheet
. Assuming this acts as a normal UIAlertView
, you should be able to change the properties on this alert to fit your needs. I would also read through saurik's Cydia Substrate project, specifically MobileSafety.mm to see some use cases. I've also found noweibogoodsleep which provides an example of using SBAlertItem
on the SpringBoard.
I've also found SBUserNotificationAlert
, a subclass of SBAlertItem
. This appears to have more methods to facilitate alert customization that may fit your needs better than the standard SBAlertItem
.
I realize hooking into private APIs is probably not what you were expecting when asking this question. Since I don't know how Uber works, I can only provide an answer from my personal experience working with the runtime and jailbroken devices.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…