当我尝试构建并运行我的键盘扩展时,它有时只会崩溃Thread 1: signal SIGQUIT.
我无法重现错误.有时我可以构建和运行我的应用程序,但大多数时候键盘才会退出.这发生在实际设备上.在模拟器中,它没有打开键盘说Waiting to Attach.
控制台一开始不输出任何错误.但是,如果我在Debug导航器中将下拉列表更改为View UI Hierachy,我会得到以下描述:
Details: No plist data for fetching view hierarchy: error evaluating expression “(id)[(Class)objc_getClass("DBGViewDebuggerSupport_iOS") fetchViewHierarchyWithOptions:(id)[(Class)objc_getClass("NSDictionary") dictionaryWithObjects:(id)[(id)[(id)[(Class)objc_getClass("NSArray") arrayWithObject:(id)[(Class)objc_getClass("NSNumber") numberWithBool:1]] arrayByAddingObject:(id)[(id)[(Class)objc_getClass("NSArray") arrayWithObject:@"_UIVisualEffectBackdropView"] arrayByAddingObject:@"_UIBackdropEffectView"]] arrayByAddingObject:(id)[(Class)objc_getClass("NSNumber") numberWithBool:0]] forKeys:(id)[(id)[(id)[(Class)objc_getClass("NSArray") arrayWithObject:@"DBGViewDebuggerUseLayersAsSnapshots"] arrayByAddingObject:@"DBGViewDebuggerEffectViewsToSnapshotAsImage"] arrayByAddingObject:@"DBGViewDebuggerAlwaysEncodeLayers"]]]”: error: Execution was interrupted, reason: EXC_BREAKPOINT (code=1, subcode=0x18daddc34).
The process has been returned to the state before expression evaluation.
Method: -[DBGAbstractViewDescriber handleFetchedViewInfo:fetchError:resultHandler:]
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
Run Code Online (Sandbox Code Playgroud)
我还截取了流程的截图.
我做错了什么,怎么能阻止我的键盘扩展在运行时一直退出?它实际上是一个如描述中所述的错误吗?
我正在将我的项目从 Carthage 迁移到 SPM。我正在使用 Xcode 12.0。构建主应用程序没有任何问题,但我无法再运行我的单元测试。我在我的应用程序目标 (SPMD) 和我的应用程序测试目标 (SPMDTests) 中使用相同的框架SwiftDate v6.2.0。
我已经解决了Swift package product 'your library' is linked as a static library by 'your project' and 'your widget'. This will result in duplication of library code.。我跟着教程Swift Package Manager Static Dynamic Xcode Bug。
我可以运行我的应用程序,但我无法运行我的单元测试。错误说
Unexpected duplicate tasks:
1) Target 'SPMDTests' (project 'SPMD') has copy command from 'xxx/DerivedData/xxx/Build/Products/Debug-iphonesimulator/SwiftDate_SwiftDate.bundle' to 'xxx/DerivedData/xxx/Build/Products/Debug-iphonesimulator/SPMD.app/PlugIns/SPMDTests.xctest/SwiftDate_SwiftDate.bundle'
2) Target 'SPMDTests' (project 'SPMD') has copy command from 'xxx/DerivedData/xxx/Build/Products/Debug-iphonesimulator/SwiftDate_SwiftDate.bundle' to 'xxx/DerivedData/xxx/Build/Products/Debug-iphonesimulator/SPMD.app/PlugIns/SPMDTests.xctest/SwiftDate_SwiftDate.bundle'
Run Code Online (Sandbox Code Playgroud)
我在Realm 上尝试了相同的设置,并且没有任何问题。这是SwiftDate …
当我尝试将一个项目添加到我的数组时,它给了我和EXC BAD INSTRUCTION错误,它说
fatal error: Array index out of range
Run Code Online (Sandbox Code Playgroud)
那是代码:
var tabelle : [[Actions]] = [[]]
func doSomething() {
var results = self.fetch()
var oldProjektName: String = results[0].projektName
var count: Int = 0
for item in results {
if oldProjektName == item.projektName {
tabelle[count].append(item)
} else {
count++
tabelle[count].append(item)
}
oldProjektName = item.projektName
}
}
Run Code Online (Sandbox Code Playgroud)
只要count = 0,它就不会给我一个错误但是当count = 1时,应用程序崩溃了.
我正在尝试扩展,NSDate但我得到两个错误:
extension NSDate { //'mutating' isn't valid on methods in classes or class-bound protocols
mutating func addMonth() {
let calendar = NSCalendar.currentCalendar()
let component = NSDateComponents()
component.month = 1
self = calendar.dateByAddingComponents(component, toDate: self, options: []) //Cannot assign to value: 'self' is immutable
}
}
Run Code Online (Sandbox Code Playgroud)
我的猜测是,这NSDate是一个类而不是Swift类型,因为mutating类中的方法不能使用错误状态.如果我返回值并分配它一切正常但我想知道这不起作用的确切原因以及是否有更好的解决方法.
我知道有这种方法来检测选择了哪个UITableViewCell:
- (void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath {
}
Run Code Online (Sandbox Code Playgroud)
但我不想知道所选择的行,我想知道单元格的内容是什么,并根据我想要做的事情.那么有没有办法标记一个单元格?为了更好地理解,假设我有四个单元格1,2,3和4.当我重新排序它们并且我的订单是1,4,2,3并且我想在另一个视图中显示该值时,它会告诉我当我选择第二行时,2而不是4.