我试图用Qt生成MD5哈希.我生成的哈希需要与其他语言(如PHP)生成的其他标准MD5哈希兼容.
这段代码没有给我预期的结果:
QString encodedPass = QString(QCryptographicHash::hash(("myPassword"),QCryptographicHash::Md5));
Run Code Online (Sandbox Code Playgroud)
结果是"Þ±SoHu÷Õ?!?¡×L"而不是"deb1536f480475f7d593219aa1afd74c".有人能告诉我我做错了什么吗?
我在Xcode 4.2中创建了一个基本的应用程序.应用非常简单,我没有改变过一件事.推送运行,您将获得标准的基本应用程序窗口.如果我为我的目标启用权利并点击运行,我没有得到任何调试器错误,但窗口永远不会出现.我用Console.app检查了日志,得到了以下内容:
我得到的第一个错误:
taskgated: killed com.alsbury.EntitlementsTest[pid 15903] because its use of the com.apple.developer.ubiquity-container-identifiers entitlement is not allowed
Run Code Online (Sandbox Code Playgroud)
删除iCloud容器"com.alsbury.EntitlementsTest"后,我收到此错误:
taskgated: killed com.alsbury.EntitlementsTest[pid 15903] because its use of the com.apple.developer.ubiquity-container-identifiers entitlement is not allowed
Run Code Online (Sandbox Code Playgroud)
由于iCloud类型的东西,我甚至在我的开发者帐户中添加了一个应用程序,一个配置文件并添加了我的机器.有什么想法吗?现在很困惑.
我正在开发一个应用程序,我想在当前鼠标位置旁边显示一个NSMenu"上下文菜单".此时,我知道如何从WebView触发命令来显示上下文菜单,我似乎无法让菜单显示在屏幕上的正确位置.看起来我的坐标是从我需要的垂直方向倒置的.这似乎是一个简单的问题,但我花了很多时间来尝试最好的"最佳实践"解决方案.我是否需要确定鼠标所在的屏幕并手动计算y坐标?
这是我非常简单的代码:
- (IBAction)showMenu:(id)sender
{
CGEventRef ourEvent = CGEventCreate(NULL);
CGPoint point = CGEventGetLocation(ourEvent);
NSPoint wp = {0,0};
wp = [self.window convertScreenToBase:point];
NSLog(@"Location? x= %f, y = %f", (float)point.x, (float)point.y);
NSLog(@"Location? x= %f, y = %f", (float)wp.x, (float)wp.y);
NSEvent *event = [NSEvent mouseEventWithType:NSLeftMouseUp location:CGPointMake(wp.x, wp.y) modifierFlags:0 timestamp:NSTimeIntervalSince1970 windowNumber:[_window windowNumber] context:nil eventNumber:0 clickCount:0 pressure:0.1];
//NSEvent *event = [NSEvent eventWithCGEvent:ourEvent];
NSMenu *theMenu = [[NSMenu alloc] initWithTitle:@"Contextual Menu"];
[theMenu insertItemWithTitle:@"Item 1" action:@selector(beep:) keyEquivalent:@"" atIndex:0];
[theMenu insertItemWithTitle:@"Item 2" action:@selector(beep:) keyEquivalent:@"" atIndex:1];
[NSMenu popUpContextMenu:theMenu withEvent:event forView:nil]; …Run Code Online (Sandbox Code Playgroud) 我有一个WebView,我想保存为WebArchive.我只想保存HTML部分而不是参考图像.当我执行以下操作时,它似乎创建了一个WebArchive,其中也嵌入了图像.
[[[[[sourceSignatureWebView mainFrame] dataSource] webArchive] data]
writeToFile:@"MyWebarchive.webarchive" atomically:YES];
Run Code Online (Sandbox Code Playgroud)
除了我不想嵌入图像这一事实外,Safari似乎无法显示文件,并且在我想要的HTML部分周围显示了很多二进制乱码.我知道我可以使用textutil来创建文件,但如果可能的话,我想在Cocoa中完成所有这些操作.
有谁知道这是否可行?任何想法将不胜感激.谢谢!
cocoa ×2
entitlements ×1
md5 ×1
nsmenu ×1
objective-c ×1
qt ×1
webarchive ×1
webkit ×1
webview ×1
xcode ×1