小编kes*_*rut的帖子

应用程序崩溃与4.2 iPhone模拟器'设置启动与shell关闭'

我正在编写完全适用于4.0/4.1 iPhone模拟器的应用程序,但不是4.2.

我收到这样的警告:

检测到尝试调用iPhone上不存在的系统库中的符号:fcntl $ UNIX2003从映像TestApp中的函数get_socket_nonblocking调用.如果您在gdb中运行模拟器二进制文件时遇到此问题,请先确保'set start-with-shell off'.

如何在Xcode上设置'set start-with-shell off'?我试图将此行添加到.gdbinit但没有运气.

使用4.0/4.1 SDK,iPhone模拟器会打印有关尝试在调试窗口中调用iPhone上不存在的符号的警告,但应用程序不会崩溃.使用4.2 app崩溃.如何防止4.2崩溃?

谢谢

iphone objective-c ios-4.2

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

使UIAlertView阻止

我需要UIAlertView阻止.因为我有功能,我需要返回UIAlertView选择.但问题是显示后UIAlertView我的功能代码进一步执行所以我无法UIAlertView选择(我可以在委托方法中执行,但我需要返回函数结果).

我试图UIAlertVIew阻止NSCondition.但代码不起作用.

condition = [NSCondition new];
result = 0 ; 
[condition lock];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Fingerprint" message:@"test" delegate:window_self cancelButtonTitle:@"No" otherButtonTitles:@"Yes",nil];
[alert setDelegate:self];
[alert show];
while (result == 0) [condition wait];
[condition unlock] ;

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
 [condition lock] ;
 if (buttonIndex == 0)
 {
  result = 2; 
 }
 else if (buttonIndex == 1)
 {
  result = 3 ;
 }
 [condition signal] ;
 [condition unlock] …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch ios

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

iPhone:检测两个手指触摸

我需要检测两个手指触摸事件.如果我同时用两根手指触摸屏幕,那么就可以了.只是使用这样的代码:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
  UITouch *touch = [[touches allObjects] objectAtIndex:0];
  CGPoint point1 = [touch locationInView:self];
  CGPoint point2 ; 
  NSLog(@"First: %f %f", point1.x, point1.y) ; 
  if ([[touches allObjects] count] > 1) {
    UITouch *touch2 = [[touches allObjects] objectAtIndex:1];
    point2 = [touch2 locationInView:self];
    NSLog(@"Second: %f %f", point2.x, point2.y) ;   
  }
}   
Run Code Online (Sandbox Code Playgroud)

但是如果我握住一根手指然后用另一根手指触摸屏幕,则此代码无效.怎么实现这个?这很难吗?

iphone objective-c

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

NSStatusBar + Swift:标题显示并立即消失

我想为 macOS 制作状态栏,但在我运行应用程序后,标题显示并立即消失

func applicationDidFinishLaunching(_ aNotification: Notification) {
        // Insert code here to initialize your application
        let statusItem = NSStatusBar.system().statusItem(withLength: NSVariableStatusItemLength)
        statusItem.title = "Hello"

    }
Run Code Online (Sandbox Code Playgroud)

我认为引用有问题,但不知道如何解决这个问题。

macos nsstatusbar swift

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

如何在 C 中实现借位标志

如何通过减去两个 8 位数字来计算借位标志?

我找到了这个借用标志描述,但我还是不明白该怎么做?

如果两个数字的相减需要借位到相减的最重要(最左边)位,则进位(借位)标志也会设置。

我想我需要一个班轮。因为使用循环计算是很大的瓶颈。很高兴看到解释借用标志如何工作。

谢谢。

c

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

iOS5 ARC应用程序:__ NSAutoreleaseNoPool():类NSCFNumber自动释放,没有池到位 - 只是泄漏

我最近为我的应用项目切换到ARC.我正在使用iOS 5 SDK.运行一台iPod 4g设备我没有收到任何警告.但是试图在iPod 2g上运行我的应用程序我收到很多警告:

*** __NSAutoreleaseNoPool(): Object 0x258070 of class DataModel autoreleased with no pool in place - just leaking
*** __NSAutoreleaseNoPool(): Object 0x2530a0 of class __NSArrayM autoreleased with no pool in place - just leaking
*** __NSAutoreleaseNoPool(): Object 0x25a2e0 of class NSCFNumber autoreleased with no pool in place - just leaking
Run Code Online (Sandbox Code Playgroud)

我想使用ARC运行arm6/arm7代码之间存在差异.

如何解决这个问题?谢谢

iphone ios automatic-ref-counting

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