Adding Weibo sharing option to your app (How and Why to China)

August 16, 2015

According to TechCrunch article Apple’s App Store saw $1.7B in billings transaction in July 2015 alone. To date, the company has paid out $33 billion to App Store developers, it said – $8 billion of which was in 2015 alone.

Large chunk of growth has come from China. In fact China has overtaken U.S as number one source of downloads. And its now number three country by revenue.

Counties by Revenue

  1. United State
  2. Japan
  3. China
  4. United Kingdom
  5. Australia

By number of downloads

  1. China
  2. United State
  3. Japan
  4. United Kingdom
  5. Japan

app_downloadsThis explained my continuos puzzlement by downloads stats for Memory Game. I though it was some sort of outlier, or possibly due to the popularity of Apple Watch in China. Not so. China truly is market not to be ignored. Business model for this particular game is first two levels are for free, then £0.79 (tier 1) to unlock all levels. Alternatively you can share on social media to unlock level three for free. My sharing options are Twitter, Facebook, iMessage or eMail. In light of stats above, time has come to replace Facebook with Weibo (in China). Luckily this is pretty easy as iOS has native share sheet support for Weibo since iOS 6.

Step one is to create account on Weibo(Weibo is chinese equivalent of twitter). It’s a good idea to do this in chrome with automatic page translation on.

There is native compose sheet support built into iOS. To see it, you will have to switch device language to Chinese simplified. You will now see Weibo in Settings app’s social section, underneath Twitter, Facebook, Flickr and Vimoe. Sing in. Then its a simple matter of using SLComposeViewController.

if SLComposeViewController.isAvailableForServiceType(SLServiceTypeSinaWeibo) {
    let weibo = SLComposeViewController(forServiceType: SLServiceTypeSinaWeibo)
    weibo.addImage(UIImage(named: "${POST_IMAGE}"))
    weibo.completionHandler = { [weak self] result -> Void  in
        switch result {
        case .Done: self?.didShareWithType(.Tweet)
        default: break
    presentViewController(weibo, animated: true, completion: nil)

I only show Weibo sharing option if local language is some version of Chinese.

func shouldShowWeibo() -> Bool {
    if let languageCode = NSLocale.currentLocale().objectForKey(NSLocaleLanguageCode) as? String {
        if languageCode.rangeOfString("zh", options: NSStringCompareOptions.CaseInsensitiveSearch, range: nil, locale: nil) != nil {
            return true
    return false

In case user is not sign into Weibo in Settings app, you can share through safari using following url

if SLComposeViewController.isAvailableForServiceType(SLServiceTypeSinaWeibo) {
} else {
    var urlString = "${POST_TEXT}"
    urlString = urlString.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)!
    urlString = "${APP_URL}&pic=${POST_PICTURE_URL}&title=\(urlString)"
    let url = NSURL(string: urlString, relativeToURL: nil)

As for content of your Weibo post. I stuck to simple sentences and google translate. It’s worth noting that Weibo uses hashtags differently to twitter. It requires you to put hashtag at the beginning and the end of a word. For example : “Memory #Game#”. You can see my Weibo post here. Thank you for reading.

#Blog posts, #Coding, #iOS Development, #Technology, #Uncategorized