Provides an early look at example code for how to embed Tableau vizzes inside of a native iOS app.
This objective-c version of the Mobile App Bootstrap only supports iOS.
Hopefully straightforward:
- Install Xcode
- Download the code for the app from this repository
- Open
Mobile App Bootstrap.xcodeproj
in Xcode - Choose/click "Run"
This should run the app in a simulator, depending on the scheme set in Xcode.
In order to run on a physical device, you'll need to adjust the Team signing profile in the Xcode project. From the Xcode project navigator, click the Mobile App Bootstrap project. Within the project info, click the Mobile App Bootstrap target, choose the General tab, and set a Team in the Signing section. This starts to get into app distribution, and Apple has extensive documentation with both a Quick Start and a more detailed guide.
The app is meant to be as simple as possible: a UITabBarController with 4 UIViewControllers, each containing a WKWebView. The UIViewControllers are separated into their own classes in this sample. The Home WebView opens a local web page bundled in the app, while the other 3 WebViews open visualizations hosted on Tableau Public.
Tableau Connected Clients are used, with a modified version of the Connected Clients library. Once this sample app is farther along (see Limitations, below), the modifications to the Connected Clients library will be submitted to its repo.
AppDelegate.m
Change https://public.tableau.com
to your internal server.
Viz1ViewController.m
, Viz2ViewController.m
, Viz3ViewController.m
Change the viz URLs to point to your own visualizations. Consider including the URL query parameters in the sample URLs, described in more detail in comments in Viz1ViewController.m
.
www/index.html
Modify to suit.
This code is strictly an early look, and is sadly far from complete.
-
Links within WebViews
Tapping a link in one of these WebViews will follow the link...but there isn't a Back button included with this sample. -
Connected Clients
Connected Clients are implemented, via a simple Token Manager. Unfortunately it doesn't yet perform re-authentication. So while it will keep the user signed in between app runs and device reboots, it will timeout based on Tableau Server's setting. On Server, this is configuralbe via its .yml file:
wgserver.session.idle_limit: 240
That value is in minutes, and affects all clients: Web, Desktop, and Mobile. -
Sign In on Phone
The Sign In experience on a phone is, charitably: nonoptimal. There's a way to inject some CSS into the WebView to make things lok nicer, via some JavaScript:
"var styleNode = document.createElement('style'); styleNode.type = 'text/css'; styleNode.innerHTML = ' .tb-login{min-width:0 !important; width: " + width + "px; } .tb-login-site-picker-container {margin-left: 50px; margin-right: 50px; } '; document.getElementsByTagName('head')[0].appendChild(styleNode);"
WebView hasEvaluateJavascript
for passing this in. Sadly, the sample code doesn't yet implement this. -
Sign In approach
In this sample, Sign In happen inside the same viz as the WebView...this might need to be broken out in a separate WebView that only processes Sign In.
-
Address the Limitations above
-
Anything else you'd like to see? Please get in touch with us through the Tableau Developer Community!
This collection is supported by the community and not officially 'blessed' by Tableau Engineering or Support. What does that mean? We didn't have a QA team test it. It's a tool for learning how to embed vizzes inside a mobile application. You should not expect that there are 0 bugs.
If you have problems getting it to work, feel free to email us with questions, but we can't promise quick responses. The Tableau Developer Community is also a great resource if you need help.
A standard disclaimer: mobile-app-bootstrap is made available AS-IS with no support and no warranty whatsoever. Despite efforts to write good and useful code there may be bugs that cause unexpected and undesirable behavior. The software is strictly “use at your own risk.”
The good news: This is intended to be a self-service tool. You are free to modify it in any way to meet your needs.