小编Abd*_*mer的帖子

为iOS模拟器减慢互联网速度

我的iOS应用程序中有一个随机崩溃.在慢速互联网连接时会发生这种情况 我的办公室网速太快了.

为了在模拟器上进行测试,我安装了网络链路调节器,如下所述:安装Apple的网络链路调节器工具

现在的问题是,我选择了一个较慢的连接配置文件,但我仍然在模拟器中具有正常(快速)的互联网速度.

我还创建了自己的配置文件,并将下载带宽设置为5kbps,但仍无用.

我有:Mackbook视网膜,OSX 10.7.5,XCode:4.4.1

重新启动Xcode和Simulator也无法正常工作.

Network Link Conditioner是否还需要其他设置?或者我应该做些什么来重建崩溃?有帮助吗?

iphone xcode ios-simulator

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

XCode 7 beta调试器没有在swift代码的断点处显示变量值

在这里尝试了问题的答案,但没有一个帮助:(

我已经安装了XCode 7 beta 5,调试器在调试swift代码时不会显示变量值.它在Obj-C代码中工作正常.

我已经尝试将编译器优化级别更改为无,但它没有效果.有任何想法吗?

在此输入图像描述

debugging xcode ios

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

iOS 9禁用对从右到左语言的支持

我的iOS应用程序仅使用阿拉伯语(从右到左)语言.在iOS 9之前,视图布局和视图动画都是默认从左到右.所以,我已经定制了完整的应用程序,并且已经颠倒了默认行为,例如导航栏中的后退按钮设置为右侧而不是默认左侧.

但是现在当使用最新的SDK(Xcode 7 beta 4)编译应用程序时,一切都与我需要的相反.

有没有简单的方法来强制应用程序显示视图和行为像iOS 8和7?

我搜索并找到了解决方案,但它涉及更改所有视图的约束(取消选中"尊重语言方向").但这在大型项目中不是一个可行的解决方案.

这是使用Xcode 7 beta 4编译后的屏幕截图. .

这是使用Xcode 6编译时的屏幕截图. 在此输入图像描述

objective-c ios ios9

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

UITableView部分标题在右边而不是默认在左边

我正在开发一个应用程序,其中要求部分的标题应该在右侧而不是默认的左侧.

我搜索了很多极客建议实施:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    static UIView *headerView;

    if (headerView != nil)
        return headerView;

    NSString *headerText = NSLocalizedString(@"????? ???????", nil);

    // set the container width to a known value so that we can center a label in it
    // it will get resized by the tableview since we set autoresizeflags
    float headerWidth = 150.0f;
    float padding = 10.0f; // an arbitrary amount to center the label in the container

    headerView = [[UIView alloc] initWithFrame:CGRectMake(300, 0.0f, headerWidth, 44.0f)]; …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uitableview ios

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

在没有参考iOS 7的情况下找到UIAlertView

我在我的项目中使用的代码片段在这里回答:UIAlertView没有参考它

这是代码:

+ (UIAlertView *) getUIAlertViewIfShown {
    if ([[[UIApplication sharedApplication] windows] count] == 1) {
        return nil;
    }

    UIWindow *window = [[[UIApplication sharedApplication] windows] objectAtIndex:1];
    if ([window.subviews count] > 0) {
        UIView *view = [window.subviews objectAtIndex:0];
        if ([view isKindOfClass:[UIAlertView class]]) {
            return (UIAlertView *) view;
        }
    }
    return nil;
}
Run Code Online (Sandbox Code Playgroud)

不幸的是它无法在iOS 7中运行,我无法解除警报视图.在调试时我发现在循环中它显示视图是类UITransitionView.非常混乱,因为我找不到此视图类的任何快速文档.

任何想法如何解决这个问题?

cocoa-touch objective-c ios ios7

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

AWS S3将图像上传到Bucket iOS应用程序

我是AWS新手,并将其用于iOS应用程序.

我正在尝试将图像从我的iOS应用程序上传到名为"img.haraj.com.sa"的存储桶.当我上传任何图片时,它们不会显示在桶中.但是当我将目标更改为名为"haraj"的存储桶时,它们会被上传并显示在存储桶中.

这是政策:

{
  "Statement": [
    {
      "Sid": "**********hidden**********",
      "Action": [
        "s3:GetObject",
        "s3:PutObject"
      ],
      "Effect": "Allow",
      "Resource": [
       "arn:aws:s3:::haraj/*"
      ]
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

我修改它来更改目标存储桶.我还创建了名为"img1.haraj.com.sa"的其他存储桶并试图上传图像,不幸的是它们也失败了.

使用点(.)和没有点的桶名称似乎存在一些问题.没有圆点的存储桶名称适用于iOS应用程序,带点的名称不起作用.我不确定.但是我正面临着这个问题.我在应用程序代码中没有收到任何错误响应.

这是我的iOS应用实现的一部分:

- (void)postAdButtonPushed:(id)sender
{
    DLog(@"Post Ad")

    AmazonS3Client *s3Client = [[AmazonS3Client alloc] initWithAccessKey:AWS_ACCESS_KEY_ID withSecretKey:AWS_SECRET_KEY];
    s3Client.timeout = 240;

    NSString *bucketName = [NSString stringWithFormat:@"img.haraj.com.sa"];
    NSString *imageName = [NSString stringWithFormat:@"testimage.jpg"];

    S3PutObjectRequest *objReq = [[S3PutObjectRequest alloc] initWithKey:imageName inBucket:bucketName];
    objReq.contentType = @"image/jpeg";

    UIImage *testImageToUpload = [self.imagesToUpload objectAtIndex:0];

    NSData *imageData = UIImageJPEGRepresentation(testImageToUpload, 0.8);
    objReq.data = imageData;
    objReq.delegate = self;

    objReq.contentLength = [imageData …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c amazon-s3 amazon-web-services ios

9
推荐指数
2
解决办法
8501
查看次数

UITextView没有显示长文本

我的iOS应用程序没有显示长属性字符串.我在tableview中有一个包含此textView的单元格.当文本很长时,tableview暂时没有响应,但是当它加载时,文本没有显示.所有其他单元格显示正常.textView可以很好地处理小文本字符串.

这是代码:

            descriptionCell = [tableView dequeueReusableCellWithIdentifier:@"CellAdDetailDescription"];
            descriptionCell.bodyTextView.delegate = self;
            NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:self.ad.body];

            UIFont *cellFont;
            cellFont = [UIFont fontWithName:@"HelveticaNeue" size:16.0];

            NSDictionary *attributesDictionary;
            NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
            paragraphStyle.lineSpacing = 10;

            attributesDictionary = @{NSParagraphStyleAttributeName : paragraphStyle , NSFontAttributeName: cellFont};

            [str addAttributes:attributesDictionary range:NSMakeRange(0, str.length)];
            descriptionCell.bodyTextView.attributedText = str;
Run Code Online (Sandbox Code Playgroud)

我在这里粘贴了长串.我调试并str正在加载包含所需文本的正常.

这里有什么不对?允许的最大字符串长度是UITextView多少?

编辑:非常奇怪,当在textView中尝试选择时,文本显示在放大镜中.我在这里发了一个视频.

这是UITextView中的错误吗?

这是截图.底部的空白是textView. 这是截图

objective-c uitableview uitextview ios

9
推荐指数
2
解决办法
4997
查看次数

将app转换为64位时,在typedef枚举时发出警告

我正在将我的iOS应用程序转换为64位.我安装了最新的Xcode 5.1(beta 4).

当我编译应用程序时,我收到了超过100个警告,其中大部分很容易修复.但是,我对以下代码发出警告:

+ (CommentResponseStatus)commentReponseStatusCodeWithStatusString:(NSString *)_status
{
    NSArray *commentStatusString = [NSArray arrayWithObjects:@"success", @"needConfirmation", @"stopped", nil];

    return [commentStatusString indexOfObject:_status];
}
Run Code Online (Sandbox Code Playgroud)

在哪里CommentResponseStatus声明:

typedef enum {
    success,
    needConfirmation,
    stopped
} CommentResponseStatus;
Run Code Online (Sandbox Code Playgroud)

我有一个警告"隐式转换失去整数精度:' NSUInteger'(又名' unsigned long')到' CommentResponseStatus'"

警告就行了 return [commentStatusString indexOfObject:_status];

NSArray我们有- (NSUInteger)indexOfObject:(id)anObject;

我对此警告感到困惑,现在不知道如何修复它.任何快速帮助将不胜感激.

64-bit enums objective-c ios

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

Crashlytics记录错误

我正在使用Crashlytics for iOS录制错误.

NSDictionary *detail = @{@"message":errorWithURL, @"response":jsonString};
[[Crashlytics sharedInstance] recordError:[NSError errorWithDomain:@"send request" code:0 userInfo:detail]];
Run Code Online (Sandbox Code Playgroud)

但是我没有在Crashlytics控制台中看到这条消息.

看到这里.

我在这里做错了吗?

objective-c ios crashlytics google-fabric

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

-[UIThreadSafeNode canPerformAction:withSender:]: unrecognized selector sent to instance

I am facing this crash in my iOS app.

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x1b9079c30 __exceptionPreprocess
1  libobjc.A.dylib                0x1b8d940c8 objc_exception_throw
2  CoreFoundation                 0x1b8f77fc0 -[NSOrderedSet initWithSet:copyItems:]
3  CoreFoundation                 0x1b907e3d4 ___forwarding___
4  CoreFoundation                 0x1b9080570 _CF_forwarding_prep_0
5  UIKitCore                      0x1bcf33444 -[UIKeyboardImpl deleteForwardAndNotify:]
6  UIKitCore                      0x1bcf39154 __57-[UIKeyboardImpl acceptPredictiveInput:executionContext:]_block_invoke
7  UIKitCore                      0x1bcf5b0c8 -[UIKeyboardTaskExecutionContext returnExecutionToParentWithInfo:]
8  UIKitCore                      0x1bcf366ec __100-[UIKeyboardImpl addWordTerminator:afterSpace:afterAcceptingCandidate:elapsedTime:executionContext:]_block_invoke
9  UIKitCore                      0x1bcf5b0c8 -[UIKeyboardTaskExecutionContext returnExecutionToParentWithInfo:]
10 UIKitCore                      0x1bcf2bdc0 __55-[UIKeyboardImpl handleKeyboardInput:executionContext:]_block_invoke_2
11 UIKitCore                      0x1bcf5cd70 -[UIKeyboardTaskEntry execute:]
12 UIKitCore                      0x1bcf5b6d4 -[UIKeyboardTaskQueue continueExecutionOnMainThread]
13 libobjc.A.dylib                0x1b8d8faf0 -[NSObject performSelector:withObject:]
14 Foundation …
Run Code Online (Sandbox Code Playgroud)

objective-c ios swift

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