我在iOS 8.1上遇到CoreData并发问题.
我正在为崩溃获得以下堆栈跟踪:
NSInternalInconsistencyException - Invalid rowCache row is nil
0 CoreFoundation 0x0000000183b6659c __exceptionPreprocess + 132
1 libobjc.A.dylib 0x00000001942640e4 objc_exception_throw + 56
2 CoreData 0x000000018385b8b8 -[NSSQLCore _newRowCacheRowForToManyUpdatesForRelationship:rowCacheOriginal:originalSnapshot:value:added:deleted:sourceRowPK:properties:sourceObject:newIndexes:reorderedIndexes:] + 6668
3 CoreData 0x00000001838fbea0 -[NSSQLCore recordToManyChangesForObject:inRow:usingTimestamp:inserted:] + 2604
4 CoreData 0x0000000183857638 -[NSSQLCore prepareForSave:] + 1052
5 CoreData 0x00000001838569b4 -[NSSQLCore saveChanges:] + 520
6 CoreData 0x000000018381f078 -[NSSQLCore executeRequest:withContext:error:] + 716
7 CoreData 0x00000001838e6254 __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke + 4048
8 CoreData 0x00000001838ed654 gutsOfBlockToNSPersistentStoreCoordinatorPerform + 176
9 libdispatch.dylib 0x00000001948a936c _dispatch_client_callout + 12
10 libdispatch.dylib 0x00000001948b26e8 _dispatch_barrier_sync_f_invoke …Run Code Online (Sandbox Code Playgroud) 大约两个月前,我发现了Peter Jay Salzman写的这个非常棒的GDB教程.
它曾经在这里可以访问,但我认为该网站现在已经下降了几个月.
我在archive.org上找到了它,想要反映它.我试过Wget和HTTrack无济于事; 他们都出错了.谷歌搜索也没有透露太多.
这个网站有镜子吗?
我可能有一个简单的问题,但在编译过程中没有信息错误或警告,提醒我出错的地方.
我有一个Objective-C++应用程序,其中包含C++主文件和ObjC头文件.
它构建正常,但运行时,它会给出以下错误消息:
Dyld Error Message:
Symbol not found: _OBJC_CLASS_$_AppController
Referenced from: /Users/slate/Documents/osirixplugins/eqOsirix/build/Development/rcOsirix.app/Contents/MacOS/rcOsirix
Expected in: flat namespace
in /Users/slate/Documents/osirixplugins/eqOsirix/build/Development/rcOsirix.app/Contents/MacOS/rcOsirix
Run Code Online (Sandbox Code Playgroud)
没有任何谷歌搜索导致解决方案,我敢肯定我错过了某个地方的编译或构建选项.
"AppController.h"包含在目标(已选中)中,并且包含在#importObjC类文件中.
任何帮助是极大的赞赏.
ObjC++经常让我头疼.
谢谢,
-S!
我正在使用a UISegmentedControl来切换UITableView两个数据集(想想收藏夹和最近的数据集).点击分段控件会使用不同的数据集重新加载tableview.
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:anim];
Run Code Online (Sandbox Code Playgroud)
当用户滑动以删除行时,它可以正常工作.然而,当用户通过分段控件切换数据集时,DELETED CELL会在不改变其外观的情况下重新使用(即红色的"DELETE"按钮仍然存在且行内容无处可见).这似乎是大多数人看到的相反问题,即删除按钮没有出现.
这是删除代码:
- (UITableViewCellEditingStyle) tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleDelete;
}
- (void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
if ([self.current isEqualTo:self.favorites])
{
Favorite *fav = self.favorites[indexPath.row];
NSMutableArray *mut = [self.favorites mutableCopy];
[mut removeObjectAtIndex:indexPath.row];
self.favorites = mut;
self.current = self.favorites;
[self.tableView deleteRowsAtIndexPaths:@[indexPath]
withRowAnimation:UITableViewRowAnimationAutomatic];
}
}
}
Run Code Online (Sandbox Code Playgroud)
tableview设置为单选,和self.tableView.editing == NO.我也尝试过使用[self.tableView reloadData]和删除/插入从一个数据集到下一个数据集的行差异.两者都不起作用.
在UITableViewCell我使用的是不供应backgroundView或selectedBackgroundView
[编辑]
分段控制值已更改: …
我甚至不确定从这个问题开始......
我希望能够将鼠标单击事件发送到另一台计算机,就像用户单击该计算机一样.
我可以通过以下方式在同一台机器上完成:
CGEventSourceRef source = CGEventSourceCreate(NULL);
CGEventType eventType = kCGEventLeftMouseDragged;
CGPoint mouseCursorPosition;
mouseCursorPosition.x = point.x;
mouseCursorPosition.y = point.y;
CGMouseButton mouseButton = kCGMouseButtonLeft;
CGEventRef mouseEvent = CGEventCreateMouseEvent ( source,
eventType,
mouseCursorPosition,
mouseButton );
CGEventSetType(mouseEvent, kCGEventLeftMouseDragged); // Fix Apple Bug
CGEventPost( kCGSessionEventTap, mouseEvent );
CFRelease(mouseEvent);
Run Code Online (Sandbox Code Playgroud)
但是我如何在其他地方发送该事件?AppleScript的?我已经阅读了AppleEvents与app-app通信的一些内容,但我想在另一台机器上生成一个系统事件?
完全不确定.
谢谢,
[编辑11/1/10 7:30a]
只是为了澄清,我不打算屏幕分享.至少我不这么认为.我有几个连接在一起的mac pro集群,每个都有4个监视器.我试图只使用一个设备来向每个节点传达"点击".因此,如果设备在节点3上,但设备插入node0,则node0需要告知节点3它需要响应点击.
谢谢,
[编辑11/4/10 9:32 am]
真?没有人能给我一个具体的代码示例,以编程方式生成Apple事件,以便在C/C++/Objc-C中的远程机器上创建鼠标事件.
Hoookay,
所以我知道我要打十几个"加载lib dummy"的答案,但是这里......
junk.framework正在导出另一个项目的某些对象(junk.app),所以我可以在集群上的remote.app节点上使用它.我可以编译junk.framework(我意识到动态加载不再意味着什么)并编译并链接remote.app到junk.framework.
但是,当我运行remote.app时,我得到了一个错误的可爱宝石:
dyld: Library not loaded: @executable_path/../Frameworks/libtiff.dylib
Referenced from: /Users/slate/Documents/junk/build/Development/junk.framework/Versions/A/junk
Reason: image not found
Run Code Online (Sandbox Code Playgroud)
我认为发生的事情是junk.framework正在从某个位置加载libtiff.dylib并且无法找到它.junk.framework是我正在研究的另一个项目,我只需要构建(最后).
当我get info在我的垃圾目标中使用libtiff.dylib时,它给了我/Users/slate/Documents/osirix/osirix/Binaries/LibTiff/libtiff.dylib一条路径...而且我已经被absolute path选中了.那么为什么不寻找呢?
呃...为什么要看@executable_path /../ ???? 那个地方到底是什么设置所以我可以改变它?
编辑---
otool -L给了我这个:
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 677.26.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 949.54.0)
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 12.0.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
@executable_path/../Frameworks/libtiff.dylib (compatibility version 11.0.0, current version 11.4.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, …Run Code Online (Sandbox Code Playgroud) 我正在构建一个商业应用程序,我们正在使用一些GPL代码来帮助我们.
我如何添加#warning或#error声明,以便在为调试构建代码时,它会发出警告,但是当我们构建发布时它会抛出错误?
我可以:
#warning this code is released under a CCL licensing scheme, see Source_Code_License.rtf
#warning this code is not LGPL-compliant
#warning this code was copied verbatim from a GP Licensed file
Run Code Online (Sandbox Code Playgroud)
在文件的开头,但我可以做得更好吗?如果包含文件,是否有更好的标记文件的方法?
我正在使用带有gcc或clang的Objective-C++.
我有一个扩展的帮助方法 SKPhysicsContact
extension SKPhysicsContact {
/// - returns: `[SKPhysicsBody]` containing all the bodies that match `mask`
func bodiesMatchingCategory(mask: UInt32) -> [SKPhysicsBody] {
let bodies = [bodyA, bodyB]
return bodies.filter { ($0.categoryBitMask & mask) != 0 }
}
}
Run Code Online (Sandbox Code Playgroud)
在didBeginContact()我呼吁在过了这个方法contact.
func didBeginContact(contact: SKPhysicsContact) {
let ballMask: UInt32 = 0x1 << 2
let ball = contact.bodiesMatchingCategory(ballMask)
...
Run Code Online (Sandbox Code Playgroud)
我有时会收到此错误消息(如5中的1),这会导致应用程序崩溃:
-[PKPhysicsContact bodiesMatchingCategory:]: unrecognized selector sent to instance 0x165f2350
Run Code Online (Sandbox Code Playgroud)
我查了一下PKPhysicsContact,它是私人框架(链接)的一部分. SKPhysicsContact看起来它只是一个空的类定义,它只暴露了某些属性PKPhysicsContact.
我觉得这是SpriteKit团队的一个Objective-C黑客攻击,打破了Swift强大的打字.
救命?
如何确保我总是 …
我正在尝试使用iOS钥匙串测试加密.
Domain=com.apple.LocalAuthentication Code=-1009 "ACL operation is not allowed: 'od'" UserInfo={NSLocalizedDescription=ACL operation is not allowed: 'od'}
Run Code Online (Sandbox Code Playgroud)
这是我的测试代码:
func testEncrpytKeychain() {
let promise = expectation(description: "Unlock")
let data: Data! = self.sampleData
let text: String! = self.sampleText
wait(for: [promise], timeout: 30)
let chain = Keychain(account: "tester", serviceName: "testing2", access: .whenPasscodeSetThisDeviceOnly, accessGroup: nil)
chain.unlockChain { reply, error in
defer {
promise.fulfill()
}
guard error == nil else {
// ** FAILS ON THIS LINE WITH OSSTATUS ERROR **
XCTAssert(false, "Error: \(String(describing: error))")
return
} …Run Code Online (Sandbox Code Playgroud) 我在自定义MFMailComposeViewControlleriOS 13 上的外观时遇到问题。
我的应用程序在导航栏中使用深色导航栏和白色色调。
UINavigationBar.appearance().tintColor = BrandManager.globals.textColor
UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor: UINavigationBar.appearance().tintColor]
// navBar color for app
UINavigationBar.appearance().barTintColor = BrandManager.primaryColors.background
// navBar color for some sharing containers…except MFMessageComposeVC & SLComposeVC (twitter)
UINavigationBar.appearance().backgroundColor = BrandManager.primaryColors.background
// navBar color for MFMessageComposeVC & SLComposeVC
UINavigationBar.appearance().setBackgroundImage(UIImage(color: BrandManager.primaryColors.background), for: .default)
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).tintColor = BrandManager.globals.textColor
Run Code Online (Sandbox Code Playgroud)
这适用于 iOS 12 及更早版本。
对于 iOS 13,我得到以下非常奇怪的行为,其中栏按钮项为白色,标题文本为黑色,向上滚动会在正确的导航栏颜色上产生这种奇怪的半透明白色。
我已经尝试了所有我能想到的UIBarButtonItem外观组合,但似乎没有任何效果。我发现的大多数其他解决方案都与 iOS 13 无关。
uinavigationbar uibarbuttonitem uiappearance mfmailcomposeviewcontroller ios13
objective-c ×4
ios ×3
macos ×3
c++ ×2
dyld ×2
cocoa ×1
concurrency ×1
core-data ×1
events ×1
frameworks ×1
gcc ×1
gdb ×1
interop ×1
ios13 ×1
ios7 ×1
keychain ×1
macos-carbon ×1
mfmailcomposeviewcontroller ×1
mirror ×1
mouse ×1
osstatus ×1
pragma ×1
sprite-kit ×1
swift ×1
uiappearance ×1
uitableview ×1
warnings ×1
xcode ×1
xctest ×1