我的应用程序遇到了一些奇怪的问题,使用它时会崩溃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) 在iOS 8及更低版本中显示UIActionSheet何时呈现键盘将在键盘上显示操作表.对于iOS 9,情况已不再如此.
在我的应用程序中,我们有一个聊天功能,并希望该节目通过键盘进行操作.我们过去常常使用UIActionSheet哪种工作正常,直到iOS 8.在iOS 9中,操作表存在于键盘后面.我都试过UIActionSheet和UIAlertController.
我已经尝试将动作表放在它自己的窗口中并覆盖canBecomeFirstResponder,这使得键盘消失了.
我得到的日期字符串是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)
它返回零.有什么想法吗?
通过更新客户端的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标题.但是怎么样?
我有一个使用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) 我想在我的设备中测试应用程序作为iTunes Connect中的内部测试程序.根据通过itunes testflight服务安装应用程序的新规则,我在我的设备中安装了新的TestFlight本机应用程序.我有一个邀请作为内部测试人员.

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

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

现在我按"打开"按钮,它重定向到testFlight但它不显示该应用程序的安装屏幕.它显示为我在此问题中分享的第一张图片.
这是我第一次尝试从新的testFlight安装应用程序.所以请给我一些想法,在itunes testFlight中安装应用程序.
我在Xcode 7中使用Launch Screen故事板来支持iOS 9,并使用imageSet来支持iOS 7.
我UIImageView在全屏幕上放入LaunchView的第一件事,并在源头使用下面的图像(见图像)到该imageView,但是当我在模拟器中运行我的应用程序时,此图像无法正确显示(iPhone 4s,5,6和6 plus)
问题出在哪儿?
有人可以帮忙吗?
我正在尝试用 Swift 制作一个UILabel- 标签将显示简体中文字符。我正在尝试使用 Mac 附带的 Kaiti SC 字体,它在字体簿和 Mac 上的所有程序中都可用,但是当我使用以下代码列出字体时,它没有显示。
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 }\nRun 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";\nRun Code Online (Sandbox Code Playgroud)\n\n我本以为 Mac 上的所有字体都可以在我的 Swift 程序中使用。(当然,该代码可以与其他字体(例如“Baskerville”)一起使用,汉字在这些字体中看起来不太好。)有什么想法吗?
\n我有一个旧的应用程序,因为iOS7具有奇怪的布局行为.它不是一个故事板应用程序.
我创建了一个故事板应用程序并在检查器中遇到了"Extend Edges",这似乎解决了该特定应用程序的问题,但是我的旧应用程序中没有这些选项.
有没有办法让我以编程方式设置这些选项?
我正在做Work light Project,我需要一个插件来获取广告标识符,除非用户硬重置手机,否则该值不会改变.
但是因为我之前从未做过IOS,所以我不知道如何在IOS 6,7上获得广告标识符.
我尝试使用identifierForVendor,但每次重新安装应用程序时它都会改变.
对我有什么帮助?(我不需要将此应用程序推送到appstore).
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)
但仍面临同样的错误.
我有个问题.我想知道如何删除警告?谢谢
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)
ios ×11
objective-c ×4
ios9 ×3
iphone ×3
xcode ×3
swift ×2
ads ×1
app-store ×1
fonts ×1
identifier ×1
info.plist ×1
ios7 ×1
keyboard ×1
nscalendar ×1
nsdate ×1
nsurlrequest ×1
oauth-2.0 ×1
uiimage ×1