小编HDd*_*per的帖子

如何在NSLog中打印int*&unsigned int*?

如何打印int*(int指针)和unsigned int*在日志中使用NSLog

- (int) doSomethingWith:(unsigned int)Msg withWparam:(unsigned int*)wParam withParameter:(int *) lParam
{
    NSLog(@"MSg:%d wParam:%u lParam:%u",Msg,wParam,lParam);
//not working
    return 1;
}
Run Code Online (Sandbox Code Playgroud)

警告: Format specifies type 'unsigned int' but the argument has type 'unsigned int *'

objective-c nslog

29
推荐指数
2
解决办法
5万
查看次数

不是PNG filCommand copypng发出错误但没有返回非零退出代码来指示失败

我在iPad上运行项目时添加图像时出现以下错误.它在所有图像的模拟器上运行良好,但在iPad上运行但没有显示图像.

CopyPNGFile /Users/user/Library/Developer/Xcode/DerivedData/RImageGallery-cmwaittvclhwgxfpcoarddipyliv/Build/Products/Debug-iphoneos/RImageGallery.app/Default.png PhotoBrowserDemo/Default.png
    cd /Users/user/Desktop/Demo
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng -compress "" /Users/user/Desktop/Demo/PhotoBrowserDemo/Default.png /Users/user/Library/Developer/Xcode/DerivedData/RImageGallery-cmwaittvclhwgxfpcoarddipyliv/Build/Products/Debug-iphoneos/RImageGallery.app/Default.png

   Not a PNG filCommand /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng emitted errors but did not return a nonzero exit code to indicate failure




(null): While reading /Users/user/Desktop/Demo/PhotoBrowserDemo/Default.png pngcrush caught libpng error:




(null): Could not find file: /Users/user/Library/Developer/Xcode/DerivedData/RImageGallery-cmwaittvclhwgxfpcoarddipyliv/Build/Products/Debug-iphoneos/RImageGallery.app/Default.png




Command /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng emitted errors but did not return a nonzero exit code to indicate failure
Run Code Online (Sandbox Code Playgroud)

iphone default.png ipad ios ios6

21
推荐指数
2
解决办法
2万
查看次数

运行操场时出错.无法找到合适的目标设备.(iOS Swift)

我在XCode中创建了一个新项目.

文件>新建>游乐场(选项+ shift + cmd + N)

在此输入图像描述

我重新启动了我的XCode并重启了我的系统,但仍然出现同样的错误.

xcode swift xcode6 swift-playground

13
推荐指数
4
解决办法
7101
查看次数

找到了多个代码签名身份(即证书和私钥对)匹配

Code Sign error: Multiple matching codesigning identities found: Multiple codesigning identities (i.e. certificate and private key pairs) matching “iPhone Developer: Coders (4B4R89J5KK43GU33E64I4347VZ)” were found
CodeSign error: code signing is required for product type 'Unit Test Bundle' in SDK 'iOS 8.0'
Run Code Online (Sandbox Code Playgroud)

我无法在设备上测试该应用.

我还.developerprofile从我的队友导入了该文件,并且能够将应用程序上传到应用程序商店,但无法在设备上测试应用程序.

keychain所有证书中都有效.

我试图删除iOS Provisioning Profiles.

我还使用这些步骤刷新了我的设置

  • 在Xcode首选项中
    • >在帐户中,单击您的Apple ID
    • >单击查看详细信息
    • >单击您的项目供应配置文件
    • >单击左下角的刷新按钮

再次清理并构建,但仍然面临在设备上运行的相同问题.

xcode keychain ios provisioning-profile xcode6

10
推荐指数
3
解决办法
5477
查看次数

CustomTableCellView的-layoutSubviews实现需要调用super,NSInternalInconsistencyException

在tableView xib的自定义单元格中使用autoLayout时,我收到以下错误.

在iOS 6模拟器中运行时, CustomCells的-layoutSubviews实现需要调用super

Assertion failure in 

-[CustomCells layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2372/UIView
     *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. CustomCells's implementation of -layoutSubviews needs to call super.'
    *** First throw call stack:
Run Code Online (Sandbox Code Playgroud)

在iOS 5模拟器中运行时

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The NIB data is invalid.'
*** First throw call stack:
Run Code Online (Sandbox Code Playgroud)

温度修复:

如果在自定义单元格中禁用autoLayout,它工作正常.但在这种情况下,定向处理并不好.请帮忙.

iphone uitableview ios ios6

8
推荐指数
2
解决办法
7050
查看次数

在iOS中使用控件播放音频

我做了一个应用程序tab bar,nav bar and table view.

在表格视图中,您可以选择收听某些音频.

新视图打开,我有一些控件,如:播放,暂停,音量滑块,进度滑块,标签与当前时间.

它有效但不完美.我可以播放音频,我可以暂停音频,我也可以使用滑块向前或向后跳过.但现在:

当我按下导航栏上的"后退"按钮时,歌曲会继续播放.没关系,但是当我再次回到视图时,计时器和滑块会自行重置.我不能暂停这首歌,只需要等待它停止播放.

另外,当我点击播放时,返回表格视图,选择要播放的另一个文件,第一个文件不会停止播放.

这是Audio1DetailViewController.h代码:

     #import <UIKit/UIKit.h>
     #import <AVFoundation/AVFoundation.h>

     @interface Audio1DetailViewController: UIViewController <AVAudioPlayerDelegate> {

     IBOutlet UISlider *volumeControl; 
     IBOutlet UILabel  *timerLabel; 
     IBOutlet UISlider *progressBar; 

     AVAudioPlayer *audioPlayer;
     NSTimer *playbackTimer; 

     }

     @property (nonatomic, retain) IBOutlet UISlider *volumeControl;
     @property (nonatomic, retain) IBOutlet UILabel *timerLabel;
     @property (nonatomic, retain) IBOutlet UISlider *progressBar;
     @property (nonatomic, retain) NSTimer  *playbackTimer; 
     @property (nonatomic, retain) AVAudioPlayer *audioPlayer;
     -(IBAction) playAudio;
     -(IBAction) stopAudio;
     -(IBAction) adjustVolume;
     -(IBAction) sliderChanged;

     @end
Run Code Online (Sandbox Code Playgroud)

这是Audio1DetailViewController.m代码:

     #import "Audio1DetailViewController.h"


     @implementation …
Run Code Online (Sandbox Code Playgroud)

iphone sdk core-audio avaudioplayer ios

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

将“const char *”传递给“char *”类型的参数会丢弃限定符

我收到警告:

miniunz.c:342:25:将“const char *”传递给“char *”类型的参数会丢弃限定符

在Zip Archive 库的 miniunz.c 文件中。具体来说:

const char* write_filename;
fopen(write_filename,"wb"); //// This work fine...........
makedir(write_filename);    //// This line shows warning....
Run Code Online (Sandbox Code Playgroud)

应该如何删除这个警告以便两者都能正常工作?

c c++ objective-c gcc-warning

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

如何在应用程序处于后台时处理套接字连接的事件?

即使应用程序在后台,我也想使用以下功能?

- (void)stream:(NSStream *)theStream handleEvent:(NSStreamEvent)streamEvent
 {
        case NSStreamEventHasBytesAvailable:
        {  NSLog(@"Event:NSStreamEventHasBytesAvailable");
            if (theStream == _inputStream) {

                NSLog(@"NSStreamEventHasBytesAvailable: on Input Stream");
                uint8_t buffer[1024];
                int len;

                while ([_inputStream hasBytesAvailable]) {
                    len = [_inputStream read:buffer maxLength:sizeof(buffer)];
                    if (len > 0) {

                        NSString *output = [[NSString alloc] initWithBytes:buffer length:len encoding:NSASCIIStringEncoding];

                        if (nil != output) {

                            NSLog(@"server said: %@", output);
                             // to get local notification I am calling below method.
 [self scheduleNotification];       
                        }
                    }
                }
            }
            break;
        }
Run Code Online (Sandbox Code Playgroud)

上面的代码在foreGround中完成.我已经在apple文档中给出了所有更改,以在后台模式中运行应用程序 - voip.我应该在AppDelegate方法中写什么?

- (void)applicationDidEnterBackground:(UIApplication *)application
{
} …
Run Code Online (Sandbox Code Playgroud)

sockets iphone background multitasking ios

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

我对"匿名iOS内存"感到困惑

我有三种编写此代码的方法.第三种方式让我困惑.

第一种方式很好.

//.h
@property (weak, nonatomic) IBOutlet UIImageView *picImageStage;
//.m
NSString *name = [NSString stringWithFormat:@"allen.png"];
UIImage *image = [UIImage imageNamed:name];
UIImageView *t = [[UIImageView alloc]initWithImage:image];
self.picImageStage = t;
Run Code Online (Sandbox Code Playgroud)

第二种方式很好.

//.h
@property (retain, nonatomic) IBOutlet UIImageView *picImageStage;
//.m
NSString *name = [NSString stringWithFormat:@"allen.png"];
UIImage *image = [UIImage imageNamed:name];
self.picImageStage = [[UIImageView alloc]initWithImage:image]; 
Run Code Online (Sandbox Code Playgroud)

第三种方式错了.

//.h
@property (weak, nonatomic) IBOutlet UIImageView *picImageStage;
//.m
NSString *name = [NSString stringWithFormat:@"allen.png"];
UIImage *image = [UIImage imageNamed:name];
self.picImageStage = [[UIImageView alloc]initWithImage:image]; 
Run Code Online (Sandbox Code Playgroud)

我不明白原因.谁能帮助我?感谢:D

iphone ios

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

带有自定义按钮标题的SWT MessageBox

我想在非RCP SWT应用程序中添加自定义按钮标题.

    MessageBox messageBox = new MessageBox(shell, SWT.ICON_WARNING | SWT.ABORT | SWT.RETRY | SWT.IGNORE);
messageBox.setText("Warning");
messageBox.setMessage("Save the changes before exiting?");
 int buttonID = messageBox.open();
 switch(buttonID) {
   case SWT.YES:
  // saves changes ...
case SWT.NO:
 // exits here ...
  break;
 case SWT.CANCEL:
// does nothing ...
 }
                                    System.out.println(buttonID);

}
Run Code Online (Sandbox Code Playgroud)

它工作正常,但我按钮标题是"中止","重试","忽略"我想要自定义按钮标题,如"覆盖","重命名","取消".怎么做?
请帮忙.

*** 编辑 ********

我也试过了

MessageDialog dialog = new MessageDialog(null, "Dangerous Activity", null,
                                                    "Are you sure you want to delete?", MessageDialog.CONFIRM,
                                                    new String[]{"Preview>", "Delete", "Cancel"}, …
Run Code Online (Sandbox Code Playgroud)

java swt

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