小编rck*_*nes的帖子

UIImage imageNamed上的实时应用崩溃:

我的应用程序遇到了一些奇怪的问题,使用它时会崩溃UIImage.我[UIImage imageNamed:@"imageName"]从图像资产中获取图像.但在某些设备上,它返回nil哪个崩溃我的应用程序,但它不应该nil.我已经检查过它在主线程上运行,剩下足够的内存(虽然它运行不足).

图像是PDF作为图像资源中的单个矢量图像,这应该创建正确的图像大小.

任何人都可以给我任何关于如何解决这个问题的指示吗?

Thread : Crashed: com.apple.main-thread
0  CoreFoundation                 0x1844d7108 CFDataGetBytePtr + 36
1  Foundation                     0x18545a848 bytesInEncoding + 204
2  CoreFoundation                 0x1844e88d4 -[__NSCFString UTF8String] + 80
3  CoreUI                         0x18d6827c0 -[CUIStructuredThemeStore _canGetRenditionWithKey:isFPO:lookForSubstitutions:] + 780
4  CoreUI                         0x18d6a5614 -[CUICatalog _resolvedRenditionKeyFromThemeRef:withBaseKey:scaleFactor:deviceIdiom:deviceSubtype:sizeClassHorizontal:sizeClassVertical:memoryClass:graphicsClass:graphicsFallBackOrder:] + 1484
5  CoreUI                         0x18d6a4784 -[CUICatalog namedLookupWithName:scaleFactor:deviceIdiom:deviceSubtype:sizeClassHorizontal:sizeClassVertical:] + 148
6  UIKit                          0x18a3df338 __98-[_UIAssetManager imageNamed:scale:idiom:subtype:cachingOptions:sizeClassPair:attachCatalogImage:]_block_invoke + 424
7  UIKit                          0x18a3df0d8 -[_UIAssetManager imageNamed:scale:idiom:subtype:cachingOptions:sizeClassPair:attachCatalogImage:] + 212
8  UIKit                          0x18a4f1698 -[UIImageAsset imageWithTraitCollection:] + 404
9  UIKit                          0x18a3df7c0 …
Run Code Online (Sandbox Code Playgroud)

objective-c uiimage ios

17
推荐指数
1
解决办法
3323
查看次数

在键盘上显示UIAlertController

在iOS 8及更低版本中显示UIActionSheet何时呈现键盘将在键盘上显示操作表.对于iOS 9,情况已不再如此.

在我的应用程序中,我们有一个聊天功能,并希望该节目通过键盘进行操作.我们过去常常使用UIActionSheet哪种工作正常,直到iOS 8.在iOS 9中,操作表存在于键盘后面.我都试过UIActionSheetUIAlertController.

我们想要的是一个像messages.app中的动作表 消息应用中的操作表.

我已经尝试将动作表放在它自己的窗口中并覆盖canBecomeFirstResponder,这使得键盘消失了.

keyboard uialertcontroller ios9

16
推荐指数
3
解决办法
7104
查看次数

对于yyyy-MM-dd'T'HH的NSString到NSDate:mm:ss.SSS + 05:30格式

我得到的日期字符串是2014-01-08T21:21:22.737 + 05:30这种格式.我如何将其授予NSDate?

我试过了:

       NSString *currentDateString = @"2014-01-08T21:21:22.737+05:30";
       [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS+05:30"];
       NSDate *currentDate = [dateFormatter dateFromString:currentDateString];

       NSLog(@"CurrentDate:%@", currentDate);
Run Code Online (Sandbox Code Playgroud)

它返回零.有什么想法吗?

iphone objective-c nsdate nsdateformatter ios

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

OAuth 2承载授权标头

通过更新客户端的API,HTTPBasicAuthication方法已替换为OAuth2 BearerAuthorization标头.

使用旧API我会执行以下操作:

NSURLCredential *credential = [NSURLCredential credentialWithUser:self.account.username 
                                                         password:self.account.token 
                                                      persistence:NSURLCredentialPersistenceForSession];

NSURLProtectionSpace *space = [[NSURLProtectionSpace alloc] initWithHost:kAPIHost
                                                                    port:443
                                                                protocol:NSURLProtectionSpaceHTTPS
                                                                   realm:@"my-api"
                                                    authenticationMethod:NSURLAuthenticationMethodHTTPBasic];
Run Code Online (Sandbox Code Playgroud)

但这不适用于Bearer标题.

现在通常我会添加标题我自己添加它像这样:

NSString *authorization = [NSString stringWithFormat:@"Bearer %@",self.account.token];
[urlRequest setValue:authorization forHTTPHeaderField:@"Authorization"];
Run Code Online (Sandbox Code Playgroud)

但是这个解决方案的问题在于API将大多数调用重定向到其他URL,这与安全性有关.NSURLRequest重定向后,从请求中删除了Authorization标头,因为我无法将Bearer方法添加到其中,NSURLCredentialStorage因此重定向后无法再对其进行身份验证.

什么是好的解决方案?我只能想到捕获重定向并修改NSURLRequest它,所以它确实包括Bearer标题.但是怎么样?

nsurlconnection nsurlrequest ios oauth-2.0

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

使用AFNetworking 2.0异常解析JSON

我有一个使用AFNetworking处理JSON解析数据的问题.

这是我的代码:

        AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
        manager.responseSerializer = [AFHTTPResponseSerializer serializer];
        NSDictionary *parameters = @{@"strEmail": _logInEmail.text, @"strPassword":_logInPassword.text};
        [manager POST:@"http://carefid.com/api/user/login.php" parameters:parameters success:^

          (AFHTTPRequestOperation *operation, id responseObject) {


//NSString *string = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
              NSString *str = responseObject[@"error"];
            NSLog(@"JSON: %@", str);
            UIViewController *myController = [self.storyboard instantiateViewControllerWithIdentifier:@"rootController"];
            [self presentViewController:myController animated:YES completion:nil];

        } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
            NSLog(@"Error: %@", error);
        }];
Run Code Online (Sandbox Code Playgroud)

当我试图记录该值时,我收到此错误:

2014-07-15 14:39:08.438 carefid[7858:60b] -[_NSInlineData objectForKeyedSubscript:]: unrecognized selector sent to instance 0x1094c67a0
2014-07-15 14:39:08.441 carefid[7858:60b] *** Terminating app due to uncaught …
Run Code Online (Sandbox Code Playgroud)

objective-c ios afnetworking-2

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

如何通过itunesconnect作为ios的内部测试器从TestFlight安装应用程序?

我想在我的设备中测试应用程序作为iTunes Connect中的内部测试程序.根据通过itunes testflight服务安装应用程序的新规则,我在我的设备中安装了新的TestFlight本机应用程序.我有一个邀请作为内部测试人员.

在此输入图像描述

现在我有一个邀请通过这样的电子邮件测试应用程序,

在此输入图像描述

现在我尝试通过按下"在TestFlight中打开"按钮来安装此应用程序.现在它重定向到AppStore像这样,

在此输入图像描述

现在我按"打开"按钮,它重定向到testFlight但它不显示该应用程序的安装屏幕.它显示为我在此问题中分享的第一张图片.

这是我第一次尝试从新的testFlight安装应用程序.所以请给我一些想法,在itunes testFlight中安装应用程序.

iphone itunesconnect app-store ios

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

启动Screen.storyboard无法正常工作Xcode 7

我在Xcode 7中使用Launch Screen故事板来支持iOS 9,并使用imageSet来支持iOS 7.

UIImageView在全屏幕上放入LaunchView的第一件事,并在源头使用下面的图像(见图像)到该imageView,但是当我在模拟器中运行我的应用程序时,此图像无法正确显示(iPhone 4s,5,6和6 plus)

在此输入图像描述

问题出在哪儿?

有人可以帮忙吗?

iphone ios ios9

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

iOS 上可用的字体

我正在尝试用 Swift 制作一个UILabel- 标签将显示简体中文字符。我正在尝试使用 Mac 附带的 Kaiti SC 字体,它在字体簿和 Mac 上的所有程序中都可用,但是当我使用以下代码列出字体时,它没有显示。

\n\n
    let fontFamilyNames = UIFont.familyNames()\n\n    for familyName in fontFamilyNames {\n\n        print("Font Family Name = [\\(familyName)]")\n        let names = UIFont.fontNamesForFamilyName(familyName)\n        print("Font Names = [\\(names)]")\n    }\n
Run Code Online (Sandbox Code Playgroud)\n\n

我的 UILabel 的代码如下:

\n\n
   let characterLabel:UILabel! = UILabel(frame: CGRectMake(600,140,300,300));\n\n   characterLabel.font = UIFont(name:"Kaiti SC" , size:250.0);\n\n   characterLabel.text = "\xe8\xaf\xb4";\n
Run Code Online (Sandbox Code Playgroud)\n\n

我本以为 Mac 上的所有字体都可以在我的 Swift 程序中使用。(当然,该代码可以与其他字体(例如“Baskerville”)一起使用,汉字在这些字体中看起来不太好。)有什么想法吗?

\n

xcode fonts ios swift

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

以编程方式扩展边缘

我有一个旧的应用程序,因为iOS7具有奇怪的布局行为.它不是一个故事板应用程序.

我创建了一个故事板应用程序并在检查器中遇到了"Extend Edges",这似乎解决了该特定应用程序的问题,但是我的旧应用程序中没有这些选项.

有没有办法让我以编程方式设置这些选项?

ios ios7

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

如何在IOS上获取广告标识符

我正在做Work light Project,我需要一个插件来获取广告标识符,除非用户硬重置手机,否则该值不会改变.
但是因为我之前从未做过IOS,所以我不知道如何在IOS 6,7上获得广告标识符.
我尝试使用identifierForVendor,但每次重新安装应用程序时它都会改变.
对我有什么帮助?(我不需要将此应用程序推送到appstore).

ads identifier ios ibm-mobilefirst

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

App Transport Security已阻止明文HTTP(http://)资源加载,因为它不安全

App Transport Security已阻止明文HTTP(http://)资源加载,因为它不安全.可以通过应用程序的Info.plist文件配置临时例外.

我有所有可能的解决方案,如:`NSAppTransportSecurity

<dict>

    <key>NSAllowsArbitraryLoads</key>

    <true/>

</dict>`
Run Code Online (Sandbox Code Playgroud)

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>yourserver.com</key>
    <dict>
      <!--Include to allow subdomains-->
      <key>NSIncludesSubdomains</key>
      <true/>
      <!--Include to allow HTTP requests-->
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
      <true/>
      <!--Include to specify minimum TLS version-->
      <key>NSTemporaryExceptionMinimumTLSVersion</key>
      <string>TLSv1.1</string>
    </dict>
  </dict>
</dict>
Run Code Online (Sandbox Code Playgroud)

但仍面临同样的错误.

xcode info.plist ios ios9

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

NSGregorianCalendar已弃用

我有个问题.我想知道如何删除警告?谢谢

NSDate *fireDate = [picker_date date];

NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *offsetComponents = [[NSDateComponents alloc] init];
[offsetComponents setMinute:-10];
NSDate *heure_notification = [gregorian dateByAddingComponents:offsetComponents toDate:fireDate options:0];


UILocalNotification *local_rappel_notification = [[UILocalNotification alloc]init];
local_rappel_notification.fireDate = heure_notification;
local_rappel_notification.alertBody = @"VOUS AVEZ  UN VOL MAINTENANT DANS 10 MIN!!";
local_rappel_notification.timeZone = [NSTimeZone defaultTimeZone];
local_rappel_notification.soundName = UILocalNotificationDefaultSoundName;
local_rappel_notification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;

[[UIApplication sharedApplication ]scheduleLocalNotification:local_rappel_notification];
Run Code Online (Sandbox Code Playgroud)

}`warnig照片

xcode objective-c nscalendar

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

无法制作插座 Swift IOS 开发

我有一个问题,我有 2 个 ViewController.swift 文件。

并且在其中任何一个我都无法做出出口。

在此处输入图片说明

ios swift

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