- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Xamarin 开发 Apple Watch 应用。我添加了一个表 (WKInterfaceTable) 并使用代码隐藏填充它。但是当我点击一行时,应用程序立即崩溃。
为了做到这一点,我实际上手动编辑了 Storyboard XML 文件,因为它不能通过简单地在 Storyboard上拖放表格来工作。这是 XML:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="6221" systemVersion="14A389" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="AgC-eL-Hgc">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6213"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="3734"/>
</dependencies>
<scenes>
<!--Interface Controller-->
<scene sceneID="aou-V4-d1y">
<objects>
<controller id="AgC-eL-Hgc" title="Favorites" customClass="InterfaceController" customModuleProvider="">
<items>
<table alignment="left" id="nXC-Mh-TYy">
<items>
<tableRow identifier="default" id="zJA-dk-zIT" customClass="FavoriteRowController">
<group key="rootItem" width="1" height="40" alignment="left" spacing="6" id="ASs-9x-fCK">
<items>
<imageView width="35" height="35" alignment="left" verticalAlignment="center" image="Door" id="rac-gq-1kM"/>
<label alignment="left" verticalAlignment="center" text="Location" id="jkO-KQ-vGr"/>
</items>
<color key="backgroundColor" red="0.93625843524932861" green="0.94465947151184082" blue="0.98500943183898926" alpha="0.14000000000000001" colorSpace="custom" customColorSpace="sRGB"/>
<edgeInsets key="margins" left="2" right="2" top="2" bottom="2"/>
</group>
<connections>
<outlet property="RowLabel" destination="jkO-KQ-vGr" id="Hcb-P2-F5Q"/>
</connections>
</tableRow>
</items>
</table>
</items>
<connections>
<outlet property="InterfaceTable" destination="nXC-Mh-TYy" id="4YS-uT-eWw"/>
</connections>
</controller>
</objects>
<point key="canvasLocation" x="0.0" y="0.0"/>
</scene>
</scenes>
InterfaceController
的代码:
public partial class InterfaceController : WKInterfaceController
{
protected InterfaceController(IntPtr handle) : base(handle)
{
// Note: this .ctor should not contain any initialization logic.
}
public override void Awake(NSObject context)
{
base.Awake(context);
this.LoadTableData();
// Configure interface objects here.
Console.WriteLine("{0} awake with context", this);
}
public override void WillActivate()
{
// This method is called when the watch view controller is about to be visible to the user.
Console.WriteLine("{0} will activate", this);
}
public override void DidDeactivate()
{
// This method is called when the watch view controller is no longer visible to the user.
Console.WriteLine("{0} did deactivate", this);
}
private void LoadTableData()
{
var cityNames = new[] { "r1", "r2", "r3", "r4", "r5" };
InterfaceTable.SetNumberOfRows(cityNames.Length, "default");
for (var i = 0; i < cityNames.Length; i++)
{
var row = (FavoriteRowController)InterfaceTable.GetRowController(i);
row.RowLabel.SetText(cityNames[i]);
}
}
}
InterfaceController.designer.cs
的代码:
[Register("InterfaceController")]
partial class InterfaceController
{
[Outlet]
public WKInterfaceTable InterfaceTable { get; set; }
void ReleaseDesignerOutlets()
{
if (InterfaceTable != null)
{
InterfaceTable.Dispose();
InterfaceTable = null;
}
}
}
FavoriteRowController
的代码:
public partial class FavoriteRowController : WKInterfaceController
{
protected FavoriteRowController(IntPtr handle) : base(handle)
{
// Note: this .ctor should not contain any initialization logic.
}
public override void Awake(NSObject context)
{
base.Awake(context);
// Configure interface objects here.
Console.WriteLine("{0} awake with context", this);
}
public override void WillActivate()
{
// This method is called when the watch view controller is about to be visible to the user.
Console.WriteLine("{0} will activate", this);
}
public override void DidDeactivate()
{
// This method is called when the watch view controller is no longer visible to the user.
Console.WriteLine("{0} did deactivate", this);
}
}
FavoriteRowController.designer.cs
的代码:
[Register("FavoriteRowController")]
partial class FavoriteRowController
{
[Outlet]
public WKInterfaceLabel RowLabel { get; set; }
void ReleaseDesignerOutlets()
{
}
}
2016-11-03 10:10:58.780 MyAppWatchExtension[16255:474000] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<FavoriteRowController 0x799ec7e0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key InterfaceTable.'
*** First throw call stack:
(
0 CoreFoundation 0x00383a22 __exceptionPreprocess + 194
1 libobjc.A.dylib 0x059a0e76 objc_exception_throw + 52
2 CoreFoundation 0x00383951 -[NSException raise] + 17
3 Foundation 0x013c5732 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 238
4 Foundation 0x012eac53 _NSGetUsingKeyValueGetter + 146
5 Foundation 0x012eab3b -[NSObject(NSKeyValueCoding) valueForKey:] + 282
6 WatchKit 0x04b06c16 __58-[SPRemoteInterface handlePlistDictionary:fromIdentifier:]_block_invoke.882 + 39
7 libdispatch.dylib 0x06252c4f _dispatch_call_block_and_release + 15
8 libdispatch.dylib 0x0627550f _dispatch_client_callout + 14
9 libdispatch.dylib 0x0625be31 _dispatch_main_queue_callback_4CF + 1031
10 CoreFoundation 0x00343e7e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
11 CoreFoundation 0x00306dcf __CFRunLoopRun + 2319
12 CoreFoundation 0x0030624b CFRunLoopRunSpecific + 395
13 CoreFoundation 0x003060ab CFRunLoopRunInMode + 123
14 Foundation 0x012c5192 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 308
15 Foundation 0x012c504f -[NSRunLoop(NSRunLoop) run] + 69
16 libxpc.dylib 0x0656d8a5 _xpc_objc_main + 476
17 libxpc.dylib 0x06570175 xpc_main + 215
18 Foundation 0x01323880 +[NSXPCListener serviceListener] + 0
19 PlugInKit 0x111556b6 -[PKService run] + 954
20 WatchKit 0x04b43108 main + 148
21 libxamarin-debug.dylib 0x0584fb33 xamarin_main + 3475
22 TycoMobilePassUIiOSWatchExtension 0x001055bc xamarin_watchextension_main + 124
23 libdyld.dylib 0x062ae85d start + 1
24 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
最佳答案
如果在选择项目而不是在显示表格时发生崩溃,那么我会假设它与行选择代码有关,并从那里开始。
根据您要执行的操作,这里有两个选项:
DidSelectRow
选择行时使用,并且要操纵一些数据或移动到另一个 View 。
public override async void DidSelectRow(WKInterfaceTable table, nint rowIndex)
{
var contextForNextInterfaceController = rows[(int)rowIndex]; // this depends how you have set up the table.
Console.WriteLine($"Row selected: {rowData}");
PushController("TheNextInterFaceController", contextForNextInterfaceController);
}
public override NSObject GetContextForSegue(string segueIdentifier, WKInterfaceTable table, nint rowIndex)
{
// Can check segueIdentifier if using more segues
return new ContextForNextInterfaceController() // This needs to sub class NSObject
{
model = modelForNextInterfaceController,
};
}
public override void Awake(NSObject context)
{
base.Awake(context);
Console.WriteLine("{0} awake with context", this);
var currentContext = context as ContextForNextInterfaceController;
if (currentContext != null)
{
// Do stuff with context
}
}
FavoriteRowController
那是缺少 Storyboard中的 socket 或错误的类(class)。
this class is not key value coding-compliant for the key InterfaceTable.'
FavoriteRowController
的代码:
using Foundation;
namespace WatchConnectivity.OnWatchExtension
{
public partial class FavoriteRowController : NSObject
{
protected FavoriteRowController()
{
}
}
}
FavoriteRowController.designer.cs
的代码:
using Foundation;
using System.CodeDom.Compiler;
namespace WatchConnectivity.OnWatchExtension
{
[Register ("FavoriteRowController")]
partial class FavoriteRowController
{
[Outlet]
public WatchKit.WKInterfaceLabel RowLabel { get; set; }
void ReleaseDesignerOutlets ()
{
if (RowLabel != null) {
RowLabel.Dispose ();
RowLabel = null;
}
}
}
}
关于ios - Apple Watch Table 上的行选择崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40390548/
在 Elastic Watcher 的官方网站上,他们说 Watcher 是 Elasticsearch 的插件,可根据数据的变化提供警报和通知 可以通过定期 Elasticsearch 查询 识别相
我有一个配置了 watch OS1 架构的项目。现在我想在同一个项目中只支持 watch OS2 架构。因此,为了在现有项目中仅配置 watch OS2,我删除了 watch OS1 的所有目标,包括
我想从我的 xcode 项目生成一个 .watchface 文件。有什么方法可以从默认 watch 应用程序之外创建 .watchface 文件吗? 我找到了一个网站Facer ,他们提供定制选项并从
我的手机在 Xcode 中被列为 ineligible target 并在旁边显示(没有配对的 Apple Watch)。 我的 Apple Watch 在 iOS 设备下注册。我可以看到UDID。
最近我在 gulp watch 上遇到错误,我用谷歌搜索并试图解决这个问题,但没有成功。有谁知 Prop 体原因吗? 应用程序基于 AngulerJs 1.3 并运行在 npm 5.7.1/node
关闭。这个问题需要更多focused .它目前不接受答案。 想改善这个问题吗?更新问题,使其仅关注一个问题 editing this post . 4年前关闭。 Improve this questi
我有一个并发症,可能需要每 5 分钟更新一次。这很容易总结为每天 120 次更新。有没有办法只在用户唤醒 watch 时更新? 最佳答案 我认为您的问题的答案是否,目前没有办法只在用户唤醒 watch
有没有人有苹果 watch 在没有任何额外应用程序或集成设备的情况下生成的数据类型列表?它必须是 these 的子集,但我无法弄清楚哪些 最佳答案 数据类型的确切列表取决于型号,但最新的 Apple
在我的苹果 watch 扩展中,我想使用长按手势功能。是否有任何 api 等效于 UILongPressGestureRecognizer。我的要求是,在 watch 扩展上,我有表格想要长按单元格,
我一直在互联网上关注很多教程来学习如何设置并发症。按预期设置并发症我没有问题。 直到初始时间线条目过期。 12 小时后,我不知道如何更新它以保持并发症的存在。我将在下面分享我拥有的所有内容,希望有人可
今天几乎是偶然的,我偶然发现了索尼正在开放固件开发并在他们自己的引擎盖下创建一个项目的公告: http://developer.sonymobile.com/services/open-smartwa
目前用于语音听写的方法并不忙。使用的方法是“presentTextInputControllerWithSuggestions”。它遵循单个语音输入“VoiceInputButton -> Speak
我在获取 gulp-watch 时遇到问题或 gulp-watch-less在遵循记录的示例后触发。我最初解决的问题是lazypipe(此处未显示),但在我看来,我在使用插件的方式上做错了。这是我的简
我正在使用 Xcode 开发 Apple Watch 应用程序。我想在屏幕的左上角放置一些文本,与列出时间的位置相邻。 当我将标签向上拖动到屏幕的一部分时,它会自动向下对齐。 我看到大多数 Apple
我似乎找不到在哪里设置我的 Apple Watch 应用程序的产品名称。我确实看到了产品名称选项,但更新它没有任何作用。也看不到文档中的任何内容 最佳答案 为了让您的应用程序名称在 iPhone 上的
只是一个简单的问题。 选项和实例方法有什么区别? 基于 watch 示例,我们可以将 watcher 实现为一个选项( https://v3.vuejs.org/api/options-data.ht
是否可以设置count而不会触发 $watch打回来? $scope.count=1; $scope.$watch('count',function(){...}); 谢谢。 最佳答案 您可以使用 s
对于 sass 目前我正在使用 sass --watch path1:path2 将 scss 文件编译为 css 但我什至发现 compass watch path1:path2 还。这两款 wat
“事件”应用程序是否有 API?例如,我想从应用程序的“锻炼”部分检索信息(您燃烧的卡路里),我想检索您第一次打开应用程序时输入的个人信息。那可能吗?我如何检索这些信息? 最佳答案 没有专门针对事件应
有什么方法可以在 Apple Watch 上启用/配置 Wi-Fi 代理服务器吗? 我们想通过 Charles 测试一些东西,所以我们想将 Apple Watch 与 Charles 连接起来。 我没
我是一名优秀的程序员,十分优秀!