小编Mug*_*diq的帖子

应用程序在iOS9中使用App Transport Security崩溃

我已将Xcode升级到Xcode 7并包含了App Transport Security(ATS)功能pList.目前我通过分配YES来禁用此功能NSAllowsArbitraryLoads.现在app在模拟器上正常运行.但是,当我发布Adhoc开发版本并将其安装在设备上时.无论何时API调用它都会崩溃.

在此输入图像描述

以下是崩溃详细信息的图像: 在此输入图像描述

ios9 xcode7 app-transport-security

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

以相反的顺序填充UICollectionView

我想以相反的顺序填充UICollectionView,以便UICollectionView的最后一项首先填充,然后填充第二项,依此类推.实际上我正在应用动画,项目逐一出现.因此,我希望最后一项显示出来.

iphone ios uicollectionview uicollectionviewcell

7
推荐指数
4
解决办法
5611
查看次数

当应用被杀死时,取消InApp购买流程

in-app-purchaseiOS应用程序将要终止时是否可以取消?我处于一种情况,其中用户开始in-app-purchase进程,但同时又终止了该应用程序。我们可以通过以下代码还原InApp购买吗?

- (void)applicationWillTerminate:(UIApplication *)application
Run Code Online (Sandbox Code Playgroud)

objective-c in-app-purchase ios

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

使用iOS中的XMPP框架匿名进行身份验证

我想在iOS中使用xmpp框架匿名连接到openfire服务器.我可以通过提供JID和PW连接到开火.但是,当我尝试匿名连接时,它说"服务器不支持匿名身份验证".

我在xib文件中使用了一个按钮.当点击下面的代码时执行:

- (IBAction)login:(id)sender {

    [[self appDelegate]connect];

    NSError *authenticationError = nil;
    [self.xmppStream authenticateAnonymously:&authenticationError];
}
Run Code Online (Sandbox Code Playgroud)

以下是connect方法的代码:

- (BOOL)connect {

    [self setupStream];
    xmppStream.hostName = @"abc.xyz.com";
    //xmppStream.hostName = @"Virtuals-MacBook-Pro.local ";

    NSString *jabberID = [[NSUserDefaults standardUserDefaults] stringForKey:@"userID"];
    NSString *myPassword = [[NSUserDefaults standardUserDefaults] stringForKey:@"userPassword"];

    if (![xmppStream isDisconnected]) {
        return YES;
    }

    if (jabberID == nil || myPassword == nil) {

        return NO;
    }

    [xmppStream setMyJID:[XMPPJID jidWithString:jabberID]];
    password = myPassword;

    NSError *error = nil;
    if (![xmppStream connectWithTimeout:XMPPStreamTimeoutNone error:&error])
    {
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error"
                                                            message:[NSString …
Run Code Online (Sandbox Code Playgroud)

xmpp ios xmppframework xcode5

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

在Facebook身份验证后查看显示延迟

我使用以下代码在Facebook身份验证后显示祝酒词

if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) // check Fb is configured in Settings or not
{    
      accountStore = [[ACAccountStore alloc] init]; // you have to retain ACAccountStore
      ACAccountType *fbAcc = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
      NSString *key = @"xxxxx";
      NSDictionary *dictFB = [NSDictionary dictionaryWithObjectsAndKeys:key,ACFacebookAppIdKey,@[@"email"],ACFacebookPermissionsKey, nil];
      [accountStore requestAccessToAccountsWithType:fbAcc options:dictFB completion:^(BOOL granted, NSError *error) {
                            if (granted) {
                                NSLog(@"Perform fb registration");
                            } else {
                                NSLog(@"Facebook 1”);
                                [[Toast shared] showToast:self.view withText:@"You disabled your app from settings."];
                                NSLog(@"Facebook 2”);
                            }

                        }];
}
Run Code Online (Sandbox Code Playgroud)

NSLog(@"Facebook 1”);NSLog(@"Facebook 2”);分别执行和打印日志.但是,这两个日志之间的Toast语句在15-20秒后延迟并显示.

如果我 …

facebook objective-c toast ios

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

UILabel显示1k为int值1000和2k为2000,依此类推

我已经UILabelint值显示,我想,如果值是千像1000那么标签上应显示1K和2K 2000年及以后.怎么能实现这一目标?

iphone uilabel nsnumberformatter ios

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