小编huy*_*ync的帖子

如何从Xcode中的管理器中删除应用程序?

如果我登录到我的iOS开发人员帐户到Xcode,它会将我的所有应用程序自动加载到管理器窗口(窗口 - >管理器).现在,当我从我的帐户退出时,我的应用仍然存在于管理器中.我该如何删除它们?

应用程序仍在管理器中

xcode

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

在iOS 7,SDK 7中UIActionSheet解除后,键盘隐藏并再次显示

我在ViewController中创建了一个UIActionSheet.我还添加了代码来捕获UIKeyboardWillShowNotificationUIKeyboardWillHideNotification通知.

我的问题是当我解雇时,我得到两个通知键盘隐藏并再次显示.有人可以告诉我如何预防这个问题?它只发生在iOS 7中并使用SDK 7构建

更新一些代码:

在viewDidLoad中,我初始化一个按钮,当触摸按钮时,将显示动作表.

- (void)viewDidLoad
{
    [super viewDidLoad];

    UIButton* button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    button.frame = CGRectMake(10, 50, 100, 30);
    [button setTitle:@"Open menu" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(buttonTouched) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];

    UITextView* textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 100, 40)];
    [self.view addSubview:textView];
    [textView becomeFirstResponder];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(keyboardWillHide:)
                                                 name:UIKeyboardWillHideNotification
                                               object:nil];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(keyboardWillShow:)
                                                 name:UIKeyboardWillShowNotification
                                               object:nil];
}

- (void)searchBarCancelButtonClicked:(UISearchBar *) searchBar{
    [searchBar resignFirstResponder];
}

- (void) buttonTouched{
    UIActionSheet* actionSheet = [[UIActionSheet …
Run Code Online (Sandbox Code Playgroud)

keyboard uiactionsheet ios ios7

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

允许UILabel截断文本,但是在单词边界处

我使用a UILabel来显示文本,例如:

UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(10, 30, 100, 50)];
label.text = @"I love Apple very much";
[self.view addSubview:label];
Run Code Online (Sandbox Code Playgroud)

但是当我的标签太短时,默认情况下文本将被截断:

我爱苹果...

我希望文本截断,但保持整个单词,并保持框架大小:

我爱苹果...

要么:

我非常喜欢Apple ...

我怎样才能做到这一点?

cocoa-touch uilabel ios

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

错误Xcode 5.1:未知参数:' - cclib'[-Wunused-command-line-argument-hard-error-in-future]

今天,Apple发布了iOS 7.1.因此,我必须下载Xcode 5.1以在iOS 7.1上构建.在我的代码中有C语言.但是当我构建时,我有一个错误:

unknown argument: '-cclib' [-Wunused-command-line-argument-hard-error-in-future]
Run Code Online (Sandbox Code Playgroud)

有人告诉:这是一个严重的问题,因为clang不支持几个常见的gcc标志(最明显的是-mno-fused-madd)

那么,我该如何解决这个问题,或者我必须等待Apple的修复版本?

c++ xcode ios

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

如何在Git上合并分支时阻止删除的文件返回

我有分支"develop_refactor",基于"开发"分支.在"develop_refactor"中,我删除了"develop_refactor"中的一些文件.有时,我从"develop"合并到"develop_refactor"来更新来自"develop"的最新代码.但删除的文件又回来了.我必须再次删除.我怎么能阻止它回来?

更新:

在此输入图像描述

git

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

使用 Swift 中的新并发将同步函数转换为异步函数

我想将同步函数转换为异步函数,但我不知道正确的方法是什么。

假设我有一个需要很长时间才能获取数据的同步函数:

func syncLongTimeFunction() throws -> Data { Data() }
Run Code Online (Sandbox Code Playgroud)

然后我在下面的函数中调用它,它仍然是一个同步函数。

func syncGetData() throws -> Data {
    return try syncLongTimeFunction()
}
Run Code Online (Sandbox Code Playgroud)

但现在我想将其转换为异步函数。下面正确的做法是什么:

  • 第一种方式:

    func asyncGetData() async throws -> Data {
        return try syncLongTimeFunction()
    }
    
    Run Code Online (Sandbox Code Playgroud)
  • 第二种方式:

    func asyncGetData2() async throws -> Data {
        return try await withCheckedThrowingContinuation { continuation in
            DispatchQueue.global().async {
                do {
                    let data = try self.syncLongTimeFunction()
                    continuation.resume(returning: data)
                } catch {
                    continuation.resume(throwing: error)
                }
            }
        }
    }
    
    Run Code Online (Sandbox Code Playgroud)

我认为第一种方法就足够了,就像罗布在下面的回答一样。但是,当我在主线程上调用如下所示的异步函数时,该函数syncLongTimeFunction()也会在主线程上进行处理。所以它会阻塞主线程。

 async {       
     let data = try? await asyncGetData() …
Run Code Online (Sandbox Code Playgroud)

async-await swift

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

如何从 JNI 调用带有 int 参数的 Java 函数

我在 Activity 中有一个静态 Java 函数。该函数有 int 参数。我想从 JNI 调用这个函数。我使用下面的代码来调用,但我不知道如何传递 int 参数:

在爪哇中:

public static void updateTopScoreLeaderboard(int score) {
    Log.i("", "updateTopScoreLeaderboard " + score);
}
Run Code Online (Sandbox Code Playgroud)

在 JNI 中:

if (JniHelper::getStaticMethodInfo(methodInfo, "com/nch/myApp/MyActivity", "updateTopScoreLeaderboard", "()V"))
{
    methodInfo.env->CallStaticObjectMethod(methodInfo.classID, methodInfo.methodID);
}
methodInfo.env->DeleteLocalRef(methodInfo.classID);
Run Code Online (Sandbox Code Playgroud)

如果 Java 函数没有参数,该代码可以很好地工作。但在这种情况下(有 int 参数),它不起作用。

java-native-interface android

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

如何知道图像用于预制

如何知道预制件中使用的图像?在下面的项目(从Ray Wenderlich项目修改)中,我有一个名为的图像cat.png.我用它MyPrefab.prefab.假设我不是项目创建者,我怎样才能找出每个图像来自哪个预制件?

在此输入图像描述

c# unity-game-engine

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