Kodeco Forums

Today Extension Tutorial: Getting Started

Learn how to create a today extension for your app - allowing it to present information in the notification center, search screen and lock screen.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/697-today-extension-tutorial-getting-started
1 Like

Hi, I think. We need one more thing. We may add use tap gesture on label ( priceLabel ) to launch app. Please let me update your project.

First and foremost we need to add gesture method of viewDidLoad

    // use tap gesture on label to launch app
    priceLabel.isUserInteractionEnabled = true;
    let tapGesture = UITapGestureRecognizer(target: self, action: #selector(TodayViewController.doLaunchApp))
    priceLabel.addGestureRecognizer(tapGesture)

Second, we need to add doLaunchApp function.

func doLaunchApp() {
    if let url = URL(string: "Crypto://") {
        self.extensionContext?.open(url, completionHandler: nil)
    }
}

Last, We need update pList file .

    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>Crypto</string>
            </array>
        </dict>
    </array>

Best

Is there any error in this plist ?

2017-03-29 11:03:02.074 BTC Widget[46954:5945318] __55-[_NCWidgetExtensionContext openURL:completionHandler:]_block_invoke failed: Error Domain=NSOSStatusErrorDomain Code=-10814 “(null)”

iv added today extension to my app, and it works fine, but the collapsed view is diffrent when i send if out on testflight iv testet on iPhone 5 , iPhone 6s & iPad pro, and all looks the same, but when i send it to testflight the cell hight on and iPhone7 is diffrent http://app.simpelapps.dk/ok.png & http://app.simpelapps.dk/notok.png have anyone experienced this ?

Hello, at first I would like to thank you for all your guides they are awesome. Secondly I would like to ask if this framework (CryptoCurrencyKit.framework) is open source meaning that I can use it to build my own apps and re-distribute them. I just need the values not the app that we build here in the tutorial.

Thank you for tutorial.
When I want to add unit tests for TodayViewController class, it gives me error:

Undefined symbols for architecture x86_64:
“__T013MyAppWidget19TodayViewControllerCMa”, referenced from:
__T012MyAppTests019TodayViewControllerB0C14testFunctionNameyyF in TodayViewControllerTests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I added in TodayViewControllerTests.swift file imorting:
@testable import MyAppWidget

Could anybody help me?

This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]