小编小弟调*_*弟调调的帖子

cocoa:确保您的目标都指定了此版本的Xcode支持的SDK

方案'PrintingWebView'不包含可为运行目标My Mac 64位支持的SDK构建的可构建项.确保您的目标都指定了此版本的Xcode支持的SDK.

在此输入图像描述

macos xcode

14
推荐指数
1
解决办法
7993
查看次数

我在我的Cocoa应用程序中添加了一个WebView,它产生了一个错误

我在我的应用程序中添加了一个WebView,并使用以下代码将页面加载到其中:

-(void)awakeFromNib{
    NSString *resourcesPath = [[NSBundle mainBundle] resourcePath];
    NSString *htmlPath = [resourcesPath stringByAppendingString:@"/calendarHTML/test.html"];
    [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:htmlPath]]]; 
}
Run Code Online (Sandbox Code Playgroud)

但是,当我运行该应用程序时,我收到以下错误:

Layout still needs update after calling -[WebHTMLView layout].  
WebHTMLView or one of its superclasses may have overridden 
-layout without calling super. Or, something may have dirtied 
layout in the middle of updating it.  Both are programming errors in 
Cocoa Autolayout.  The former is pretty likely to arise if some 
pre-Cocoa Autolayout class had a method called layout, but it should …
Run Code Online (Sandbox Code Playgroud)

macos xcode cocoa objective-c

11
推荐指数
1
解决办法
2133
查看次数

cocoa:如何使背景透明webView?

mac osx,我想让我的webview看起来透明,并在其上显示数据,背景显示父视图的图像.

任何人都可以让我知道如何做到这一点?这种方法不行

NSString * source = @"<html><head><title></title></head><body><div id=\"box\">Example Box</div></body></html>";
[[webView mainFrame] loadHTMLString:source baseURL:[NSURL URLWithString:@""] ];
[[webView windowScriptObject] evaluateWebScript:@"document.getElementById('box').style.backgroundColor = '#dddddd';"]; // Change box background
[[webView windowScriptObject] evaluateWebScript:@"document.body.style.backgroundColor = '#dddddd';"]; // Change body background
Run Code Online (Sandbox Code Playgroud)

macos xcode cocoa

7
推荐指数
1
解决办法
4972
查看次数

cocoa:webview如何禁用滚动条

webview禁用滚动条双指滚动,我想禁止.

喜欢这个不可以

[[webView windowScriptObject]evaluateWebScript:@" document.body.style.overflowX='hidden';"];
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

macos cocoa objective-c

5
推荐指数
1
解决办法
2497
查看次数

如何修复php警告:file_get_contents?无法打开流:HTTP请求失败

如何修复php警告:file_get_contents?

Warning: file_get_contents(http://192.168.1.254:9999/api/p/internal/ucenter/login?loginName=test102&password=111111) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /Applications/XAMPP/xamppfiles/htdocs/PHP_test/index.php on line 49
Run Code Online (Sandbox Code Playgroud)

这是与$ files相关的代码:

<?php
$loginNames="test102";
$passwords="111111";
$apiUrl = "http://192.168.1.254:9999/api/p/internal/ucenter/login?loginName=".$loginNames."&password=".$passwords;
$callback = file_get_contents($apiUrl);

print_r($callback);
//echo $callback;
?>
Run Code Online (Sandbox Code Playgroud)

php file-get-contents

4
推荐指数
1
解决办法
4万
查看次数

致命错误:在展开Optional值时意外发现nil,获取json错误swift

在此输入图像描述

得到json错误

fatal error: unexpectedly found nil while unwrapping an Optional value当我尝试返回时,我收到错误json:

func getJson (str:NSString) -> AnyObject{

    var proxiesURL = NSURL(string:str)
    var proxiesDataJson = NSData.dataWithContentsOfURL(proxiesURL, options: NSDataReadingOptions.DataReadingUncached, error: nil)
    var json: AnyObject!

    if (proxiesDataJson != nil ){
        json = NSJSONSerialization.JSONObjectWithData(proxiesDataJson, options: NSJSONReadingOptions.AllowFragments, error: nil) as AnyObject
    }
    return json
}
Run Code Online (Sandbox Code Playgroud)

macos cocoa json objective-c swift

3
推荐指数
1
解决办法
2987
查看次数

cocoa:webView,它有超链接添加`target ="_ blank"`无法打开

webView中有添加的超链接target = " _blank "无法打开.

我开发类似webview的应用程序,但我有一个问题.如何在当前应用程序中打开新窗口中的链接 - 而不是在safari中?

感谢帮助.

在此输入图像描述

@Rob Keniger代码没有运行.为什么?

macos xcode cocoa objective-c

2
推荐指数
1
解决办法
1766
查看次数

cocoa:Integer类型如何转换为字符串类型?

代码无法运行错误:方法调用的参数太多,预期为1,有2个

NSDate *nows =[NSDate date];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *dateComponents = [gregorian components:(NSHourCalendarUnit  | NSMinuteCalendarUnit | NSSecondCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate:nows];
NSInteger hour = [dateComponents hour];
NSInteger minute = [dateComponents minute];
NSInteger second = [dateComponents second];
NSInteger month=[dateComponents month];
NSInteger day=[dateComponents day];
NSLog(@"%lu",day);    

statusItem.image=[NSImage imageNamed:@"status%lu.png",day];

[gregorian release];
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

是不是试图将Integer类型转换为字符串类型?我能做什么?

macos xcode cocoa objective-c

1
推荐指数
1
解决办法
107
查看次数

标签 统计

macos ×7

cocoa ×6

objective-c ×5

xcode ×5

file-get-contents ×1

json ×1

php ×1

swift ×1