Question about iAd being displayed on iPad & iPhone - iphone

In my App, I display and iAd but I was hoping for clarification on a few things:
1) If I display an Ad, it does not look like it will 'automagically' go away, so am I correct that it is my responsibility to dismiss it?
2) I thought I read somewhere that it must stay for a min. 30 seconds. Is that correct?
3) Is it wrong to leave it there forever and let the user dismiss it?
Thanks for the help.

1) If I display an Ad, it does not
look like it will 'automagically' go
away, so am I correct that it is my
responsibility to dismiss it?
Are you talking about a banner or the full screen ad? The banner ad is either updated with a new ad after 30 seconds, or if there is no ad, then the banner view is to be hidden. You are never supposed to show the banner view if there is no ad to be displayed. To learn how to hide the banner view, code samples are in the developer docs. There have also been many topics about this on this site.
You are not supposed to dismiss an iAd. If the full screen ad is being shown, the user dismisses it. There is a delegate callback to handle this.
2) I thought I read somewhere that it
must stay for a min. 30 seconds. Is
that correct?
I've never heard this, but read the above. It will stay for 30 seconds on it's own, no need to dismiss it. If the user is changing views to a view that has no iAd, then you don't need to do anything. But, there is a way to have the banner show on each view. To do that, see the 'iAdSuite' project at developer.apple.com
3) Is it wrong to leave it there forever and let the user dismiss it?
This is exactly what you should be doing (while there is an ad to be displayed). I really encourage you to read the iAd Programming Guide found here.
Hope this helps.

Related

UIDocumentBrowserViewController handling back navigation

Apple states that the UIDocumentBrowserViewController should be the rootviewcontroller of your app.
https://developer.apple.com/documentation/uikit/view_controllers/adding_a_document_browser_to_your_app
I have done it this way but I have some UX problem that I cant tackle.
I cant find a good UX solution for navigating back into my App (switching back the app windows rootviewcontroller again to whatever I want).
However I have found that there are some properties where I can manipulate the appearance of the control, "Use the additionalLeadingNavigationBarButtonItems and additionalTrailingNavigationBarButtonItems methods to add buttons to the navigation bar.", but these wont add items to the "main" menu (where I can select other FileProviders, drive dropbox etc.) and where the possibility of going back would be the most clear.
Does anyone implemented, knows a good solution for adding a back button, FAB, back swipe gesture, or something for UIDocumentBrowserViewcontroller which is presented in a as the apps rootviewcontroller?
Im looking for a solution when the user ended the browsing of documents in the UIDocumentBrowserViewcontroller(copy,import etc) and wants to go back to another Viewcontroller.

How to know when user has closed modally presented controller by tapping on title?

Is there a way to know in code when user has closed a modal by tapping the title? Apple's documentation states:
The title of the modal interface is set to the string Cancel unless the presented interface controller explicitly changes it using the setTitle: method. Tapping the title dismisses the interface automatically.
As far as I know there is now way to replace that title with a button.
I could fire a notification on didDeactivate() or willDisappear() but these will also be called when app enters background. So I could do an additional check in ExtensionDelegate's applicationWillResignActive() to differentiate between user's action in my app or outside my app but this seems very fragile.
Are there any better ways?
Why would one need this?
In my case I have an initial screen where a user makes a choice. After the choice is made I present screens that contain data based on that choice.
I always want to show the data when the choice has been made. So I save the choice and present the modal on app launch when it is present.
But I don't want to show the data if the user has closed the data display. Yet I still want to display the choice made on the first screen. So I can't use the fact that the choice has been made to trigger modal displaying.
Hence I need to know if the modal has dissapeared because of user interaction in app or because the app got switched away.
Unfortunately, there is no other way to do so.
But why do you need to add additional checks at applicationWillResignActive()? I think there is no need to do so.

Jump from/to loginscreen and send to specific controller (iPhone sdk)

I've been struggling with this for a while now.
And I've found some useful stuff, but I still feel like I've got the need to post here to hear peoples opinion.
Sometime I want to be able to send users to certain screens. If the app is reloaded I want to send them back to the screen where they left off and if they cannot be authorized anytime during login (if their password is changed elsewhere) I want to be able to kick them to the loginscreen.
To achieve this, I would add segues to all controllers from a "root" controller and then add segues from all controllers to the login controller. Then I could send them wherever with performSegueWithIdentifier.
BUT, is this really the way to go? Seems a bit inflexible and ugly. Is there a better way?
I would recommend implementing your login screen inside a UIWindow. This way you pop this window above any other view in your normal window regardless of where it is in the view hierarchy or modal.

What is the Best Way to Display a Non-Modal "Loading" Message on IPhone?

I have an iPhone app, and sometimes when the user presses a button, the chosen operation will take a minute or two. I would like to display a message instructing the user to wait, but not block the user from using the app in the meantime. Also I would like customizable text on the message.
Another requirement is that I use a TabBarController as the main navigation control.
My idea is to have a message appear at the top of the screen, pushing the content down by 20 pixels. Note that as there would be multiple screens, this 20 pixel message would have to be independent of any single screen.
I have tried a few different ways, each with drawbacks.
1 - Have a Root View and call AddSubView with the TabBarController. Then I can resize the TabBarController and show the message on the Root View underneath. This fails because the TabBarController child views do not receive "ViewDidAppear" messages. Interestingly, if I display a modal window at some later point, the "ViewDidAppear" messages begin to work. But I would like ViewDidAppear at the start.
2 - Similar to #1. Have a Root View and display the TabBarController as a modal view. This allows ViewDidAppear to work, but if the screen is rotated, the rotation message doesn't propogate to the Root View. So I cannot rotate the Root View.
3 - Subclass TabBarController to properly handle rotation. The Apple docs say not to do this, so I worry my app would be rejected, if I can make it work.
4 - Add two views to the main window. One for displaying the message, and one for the app content. This suffers from the same rotation problem as option #2.
Any suggestions are appreciated.
Thanks.
This is not an exact answer to your question, but you could consider to use a message on top of the status bar. Reeder uses it and I find it a very interesting and good example of unobtrusive feedback (that also saves you some pixels :). If you want to make it easily, have a look at this library (be sure to read the warning).
A second option, also suggested by Kris Van Bael on a comment, is to add a custom view just like Instagram. Again, there is detailed info in this article.
I hope that helps!

Push Notification Alert Handling

I have a doubt. I am building an application wherein if there is a new request is submitted I am getting a push notification in my application and on tap of "View" button in the push notification alert I need to show the request detail page. Now, normally this request detail page is 5th view in the stack. How should I handle this? Should I initialize first 4 views and put them on the stack before going to the detail page?
Also, there is a scenario where if someone is working on some part of the app and notification comes up. In that should I loose the changes on the currently opened page and show the request details if "View" was tapped on?
How should I handle this?
You can just push that view (the usual 5th view). The only thing is that when you pop that view, it will now act as the 2nd view, so theres no need to go through 4 additional views.
You can initialize and push the 5 views to your navigation controller (with animate:NO) to start the app up in the right place.
As for if you get a notification while running, that's really up to you and what is best for the app. You can always prompt the user before deleting any data. Note that if you get a push notification, your application:didReceiveRemoteNotification: instead of the alert showing.
This is commonly achieved by displaying the controller modally.
This way you don't have to recreate your view-controllers hierarchy and you don't lose the current context of your app if it was running. The user taps some "OK" button and returns to the previous screen.
For the first part of your question: if you have created your view in a decoupled way, that is, if it is not dependent on the 4 other views - i suppose then you can show this view without problems. Obviously the answer really depends whether your business rules allow this.
As for the second part of your question: you always can show an UIAlertView to your users asking whether they want to take action on the received push notification.
However - i think these problems really do not have anything to do with the nature of the push notifications, and you really should loose the "I have a doubt on push notification" part of your question :) ....
Hope this helps :)