1. Certificate configuration: http://blog.csdn.net/songchunmin_/article/details/51316806
2. Coding phase: http://blog.csdn.net/songchunmin_/article/details/51291752
3. Official Document: Https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/Today.html
4. There is a better document abroad: https://www.appcoda.com/app-extension-programming-today/
5.widget implementation of several common functions: HTTP://WWW.JIANSHU.COM/P/9B3D06236D19
Terms:
Main project: Adding widgets to an existing a project, then A is the main project
start~
Environment construction
1. Apple background configuration certificate, download provisioning profiles file, get 4 provisioning Profiles files (the main project and widgets are two: Dev and release).
Note that the widget project and the main project are actually two separate AppID, and the app group interacts with each other.
2. For the main project configuration:
(1) Select a new Pro certificate
(2) Open the Targets-->capabilities-->app Groups option and select the group configured in the background:
3. Add the Widget project.
Change the bundle identifier to the same appid as the Apple backend configuration. Also note that at the time of naming, the following rules must be followed: prefix to include the main project bundle Identifier. The suffix cannot be the widget keyword (...). It's a pit here, tried a lot of times. Then because my Xcode does not configure the developer account, so the automatically manage singing check out (anyway the certificate files are downloaded to you).
Then select the good provisioning profile file, Dev and release. The error on the current page should all be gone.
Set the signature in build setting:
If you were to add your phone to the DeviceID when you configured the certificate in the background of Apple, you could see a "Hello World" widget on your phone by running it directly.
First run, you may see the upper left corner of the name is the widget, this is a little delay, the second time you can see is "Baby Tree small Time."
Business logic Implementation
1. Pure Code Implementation layout:
iOS Widget development