小编Ton*_*ams的帖子

为什么在用作格式参数时,必须将NSInteger变量强制转换为long?

NSInteger myInt = 1804809223;
NSLog(@"%i", myInt); <==== 
Run Code Online (Sandbox Code Playgroud)

上面的代码产生错误:

Values of type "NSInteger" should not be used as format arguments: add an explicit cast to 'long' instead.
Run Code Online (Sandbox Code Playgroud)

正确的NSLog消息实际上NSLog(@"%lg", (long) myInt);为什么我要将myInt的整数值转换为long,如果我想要显示该值?

xcode casting objective-c

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

在Xcode 8中提供Thread Sanitizer和Address Sanitizer选项需要什么

我不知道我需要做些什么来使这些选项停止被禁用.任何帮助,将不胜感激:

在此输入图像描述

debugging xcode

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

检查入队的GCD区块?

假设我有一个串行调度队列,我在其上排队了几个操作.我已经读过,一旦发送,我就无法取消操作.是否有可能至少查看我发送的GCD块可能会做出决定,如果我想再派一个?

例如,我将操作A分派给队列,但在我的应用程序决定将另一个操作A排入队列之后不久,所以现在有两个这样的操作排队.

objective-c grand-central-dispatch

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

电影播放器​​的激活状态错误(1)

嗨!我正在从视频网址捕获视频的缩略图.我正在使用以下代码来捕获缩略图

MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc]initWithContentURL:movieURL];
[moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
[moviePlayer setFullscreen:YES];
moviePlayer.useApplicationAudioSession = NO;
UIImage *image = [moviePlayer  thumbnailImageAtTime:(NSTimeInterval)1.0 timeOption: MPMovieTimeOptionNearestKeyFrame];
Run Code Online (Sandbox Code Playgroud)

我正在使用线程.我收到以下错误:

电影播放器​​的激活状态错误(1)

有谁能够帮我?

sdk objective-c ios

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

如何在Mac OSX 10.6上安装Perl DateTime模块

好的,我知道如何使用cpan安装Perl模块并且已经使用了多年.但是当我尝试在这个特定的mac上安装DateTime模块时,它失败了,声称它找不到编译器.

以下是尝试安装其中一个先决条件的一些输出,Params :: Validate :(我在尝试安装相关模块时遇到了同样的错误.)

Configuring Params-Validate-1.00
Running Build.PL
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
lipo: can't open input file: /var/tmp//cc3Aefez.out (No such file or directory)
Warning: ExtUtils::CBuilder not installed or no compiler detected
Proceeding with configuration, but compilation may fail during Build
Run Code Online (Sandbox Code Playgroud)

为什么Build.PL正在寻找ppc编译器?如果这是问题我在哪里告诉它(或cpan,或cpanm)这台机器不是ppc盒子?

我跑10.6.8.perl的版本是为darwin-thread-multi-2level构建的v5.10.0

我绝对安装了Developer工具.

我通过sudo运行cpan和cpanm.

我很感激任何人都可以提供帮助.

macos perl cpan

3
推荐指数
2
解决办法
4191
查看次数

NSFileManager:隐藏文件夹?

我用下面的文件目录创建文件夹,我的问题是,如何隐藏这个文件夹,这样当我允许itune共享这个文件夹时不会出现给用户

/*创建新目录*/NSFileManager*filemgr; NSArray*dirPaths; NSString*docsDir; NSString*newDir;

filemgr =[NSFileManager defaultManager];

dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, 
                                               NSUserDomainMask, YES);

docsDir = [dirPaths objectAtIndex:0];

newDir = [docsDir stringByAppendingPathComponent:@"Patients"];

NSLog(newDir);

if(! [self SearchForDirectory:newDir] )
{
    NSLog(@"directory Not Exists");

    if ([filemgr createDirectoryAtPath:newDir withIntermediateDirectories:YES attributes:nil error: NULL] == NO)
    {
        NSLog(@"Failed to create directory");
    }
}
else{
    NSLog(@"directory Exists");

}
[filemgr release];
Run Code Online (Sandbox Code Playgroud)

iphone xcode objective-c

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

如何将字符串复制到iOS中的剪贴板(粘贴板)?

如何将字符串复制到iOS中的剪贴板?我在文档中搜索"剪贴板",没有点击.

cocoa-touch copy-paste uipasteboard ios

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