Dashcode 中未定义 Widget 对象
我正在将 Dashcode 用于移动 Safari Web 应用程序并来自文档 (https://developer.apple.com/library/archive/documentation/AppleApplications/Conceptual/Dashcode_UserGuide/Contents/Resources/en.lproj/MakingaWidgetwithDashcode/MakingaWidgetwithDashcode.html),看来我应该能够访问一个名为“widget”的对象。
但是,当我尝试时,我收到错误消息,指出小部件未定义。我也尝试过“window.widget”,它给了我同样的错误。
这是怎么回事?
我想在我的应用程序中创建一个可点击的链接,以使用 openURL 打开 URL(如上面 URL 中给出的示例)。
I'm using Dashcode for a mobile Safari web application and from the documentation (https://developer.apple.com/library/archive/documentation/AppleApplications/Conceptual/Dashcode_UserGuide/Contents/Resources/en.lproj/MakingaWidgetwithDashcode/MakingaWidgetwithDashcode.html), it appears that I should be able to access an object called "widget".
However, when I tried, I get the error message saying that widget is undefined. I've also tried "window.widget" and it gives me the same error.
What's going on?
I'd like to make a text in my application a clickable link to open a URL using openURL (like the example given at the URL above).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 widget.xxx 来访问小部件内部和外部的内容。
因此,要访问curl和Mac并从雅虎获取一些数据,您需要执行以下操作
来获取首选项键值,当您安装在Mac上时,该值存储在小部件plist中
我认为在问题中(下面)我们正在检查是否我们在一个小部件中,然后准备过渡到小部件的后面。
这就是我设置首选项的方式,以便它在系统重新启动之间存储(您使用获取首选项来检索它们)
,这就是您创建链接以在浏览器而不是小部件中打开的方式
这些都是我拥有的小部件中的相关工作示例建造的。希望有帮助。我发现下载与我想要的功能类似的小部件非常有用,然后安装它们并将它们作为项目打开,您可以导入,然后您可以看到所有代码。
You use widget.xxx to access things inside and outside you widget.
So to access curl and the Mac and get some data from Yahoo you do as follows
to get a preference key value, stored in the widgets plist when you install on a mac
i think in the question ask (below) we are checking to see if we are in a widget and then preparing a transition to the back of the widget.
this is how i set a preference so it is stored between system reboots (you use a get preference to retrieve them)
and this is how you create a link to open in a browser not the widget
These are all rel working examples from widgets i have built. Hope it helps. I found it useful to download widgets that performed similar functions to ones i wanted and then as well as installing them opening them as projects, you can import, and then you can see all the code.
好的,这有效...希望对其他人有帮助...
Ok, this worked...hope it will help someone else...