简体   繁体   English

我们可以在Today- Widget-Extension中共享App类吗

[英]Can we share App class in Today- Widget-Extension

I am developing an application where I have to use my some class in Today- Widget-Extension. 我正在开发一个应用程序,必须在Today-Widget-Extension中使用我的某些类。 But I am not getting any way to access those class. 但是我没有任何途径来访问那些课程。 Is it possible to access application class in Today- Widget-Extension. 是否可以在Today-Widget-Extension中访问应用程序类。

It is possible. 有可能的。 First you need to set targets of your class to both aplication and extension. 首先,您需要将类的目标设置为应用和扩展。 Second you need to put public keyword to your class. 其次,您需要在课程上添加public关键字。 You can read more on that here . 您可以在这里阅读更多内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM