The ActionSheet snippet can not be added to the -(void)viewDidLoad method, since the view it is trying to show itself in has not been attached to a window. It is attached as a subview in AppDelegate.m
Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after app launch.
[window addSubview:viewController.view];
which is called after the -(void)viewDidLoad method
if you add the snippet after
Code:
[window addSubview:viewController.view]
it will display as expected
The console error that occurs when showing the alertView in the -(void)viewDidLoad
wait_fences: failed to receive reply: 10004003
is also caused by this.
The example would be better if the calls for the alertView and the calls for the ActionView occurred after the
Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
has actually added the subView to the window.
Even though the examples as presented are not how you would use either of these views in practical terms, it is good to have code that doesn't give warnings or exceptions.