小编Zig*_*rth的帖子

iOS 8使设备在代码更新后不接收PUSH通知

我最近将我的一个测试iphone升级到iOS 8,然后升级了PUSH注册码,如下所示(使用xCode 6)

-(BOOL)hasNotificationsEnabled {

    NSString *iOSversion = [[UIDevice currentDevice] systemVersion];
    NSString *prefix = [[iOSversion componentsSeparatedByString:@"."] firstObject];
    float versionVal = [prefix floatValue];


    if (versionVal >= 8)
    {

        NSLog(@"%@", [[UIApplication sharedApplication]  currentUserNotificationSettings]);
        //The output of this log shows that the app is registered for PUSH so should receive them

        if ([[UIApplication sharedApplication] currentUserNotificationSettings].types != UIUserNotificationTypeNone) {

            return YES;

        }

    }
    else
    {
        UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
        if (types != UIRemoteNotificationTypeNone){
            return YES;
        }

    }

    return NO;
}

-(void)registerForPUSHNotifications { …
Run Code Online (Sandbox Code Playgroud)

iphone notifications push ios parse-platform

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

iOS - 设置为0时仍然存在UICollectionView间距 - 如何设置单元格之间没有间距

我有一个简单的UICollectionView,我在InterfaceBuilder中设置了0间距但是当我用单元格填充集合视图时,仍然有一些间距.是否有一些特殊而且不是很明显我需要做的是为了实际看到一个带有0间距的集合视图单元格而不是设置为0间距?谢谢.

编辑*一些代码:

- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath {

    UICollectionViewCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];

    cell.backgroundColor = [UIColor clearColor];

    UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectMake(2, 2, cell.frame.size.width -4, cell.frame.size.height -4)];
    lbl.backgroundColor = [UIColor clearColor];
    lbl.font = [UIFont boldSystemFontOfSize:20];
    lbl.text = [NSString stringWithFormat:@"$%0.0f", [[amountsArray objectAtIndex:indexPath.row] floatValue]];
    lbl.textAlignment = NSTextAlignmentCenter;
    lbl.layer.borderWidth = 1;

    [cell addSubview:lbl];
    [lbl release];

    return cell;
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

iphone layout spacing ios uicollectionview

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

亚马逊Alexa技能套件:如何与外部应用程序帐户/ userId链接

亚马逊alexa技能请求中有一个userId,我试图了解这是什么,如果有一些参考,因为我想链接和Amazon Echo用户帐户与我自己的应用程序中的帐户,并这样做我必须有某种静态userId才能使用.

示例请求:

{
 "version": "1.0",
 "session": {
   "new": false,
   "application": {
   "applicationId": "amzn1.echo-sdk-ams.app.[unique-value-here]"
  },
  "sessionId": "session1234",
  "attributes": {},
  "user": {
    "userId": null //IS THERE A DETAILED REFERENCE OF THIS SOMEWHERE?
  }
},
"request": {
"type": "IntentRequest",
"requestId": "request5678",
"intent": {
  "name": "MyColorIsIntent",
  "slots": {
    "Color": {
      "name": "Color",
      "value": "blue"
    }
  }
}
}
}
Run Code Online (Sandbox Code Playgroud)

amazon userid amazon-web-services alexa-skill alexa-skills-kit

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

OSX/Cocoa - 具有透明背景的NSScrollView

我似乎无法创建具有透明背景的NSScrollView.有谁知道为什么?这是我的代码:

NSScrollView *textScroll = [[NSScrollView alloc] initWithFrame:CGRectMake(212, 203, 381, 55)];
[textScroll setBackgroundColor:[NSColor clearColor]];
[view addSubview:textScroll];
Run Code Online (Sandbox Code Playgroud)

macos cocoa objective-c background-color nsscrollview

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

iPhone/iOS状态栏未隐藏在Xcode项目中

您好我已尝试以下但无法从我的应用程序中删除状态栏:

  1. 设置状态栏最初在plist中隐藏为YES
  2. "在应用程序启动期间隐藏"以在"项目常规"设置中勾选
  3. 在控制视图控制器的界面构建器文件中将状态栏设置为"无"
  4. 设置[UIApplication sharedApplication] .statusBarHidden = YES; 在app委托.

所有这些都曾经在我之前做过的100个应用程序中运行良好,但我最近进行了xcode升级.

有没有其他秘密方式摆脱应用程序中的状态栏?我是否需要前往Apple总部并杀死一条红龙?

iphone xcode status ios

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

AWS API Gateway:由于配置错误导致执行失败:输出映射不匹配且未配置默认输出映射

在AWS API Gateway中,我有一个调用lambda函数的GET方法.

当我在API网关仪表板中测试该方法时,lambda函数成功执行,但API Gateway未将context.success()调用映射到200结果,尽管默认映射设置为yes.

相反,我得到这个错误:

Execution failed due to configuration error: No match for output mapping and no default output mapping configured
Run Code Online (Sandbox Code Playgroud)

这是我的集成响应设置: 在此输入图像描述

这是我的方法响应设置: 在此输入图像描述

基本上我希望API网关识别成功的lambda执行,然后默认将它映射到200响应,但这不会发生.

有谁知道为什么这不起作用?

amazon-web-services aws-sdk aws-lambda aws-api-gateway

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

iPhone - NSTimer在火灾后不再重复

我正在创建并解雇NSTimer:

ncTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
                                           target:self
                                         selector:@selector(handleTimer:)
                                         userInfo:nil
                                          repeats:YES];
[ncTimer fire];
Run Code Online (Sandbox Code Playgroud)

- (void)handleTimer:(NSTimer *)chkTimer {
    // do stuff
}
Run Code Online (Sandbox Code Playgroud)

我保留我的计时器:

@property (nonatomic, retain) NSTimer *ncTimer;
Run Code Online (Sandbox Code Playgroud)

由于某种原因,计时器不重复.它只发射一次而不是再发射一次.

iphone nstimer

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

Cocoa/OSX - NSWindow standardWindowButton表现奇怪,一旦被复制并再次添加

在我的应用程序中,我更改standardWindowButtons close/miniturize/expand的位置,如下所示:

 //Create the buttons
    NSButton *minitButton = [NSWindow standardWindowButton:NSWindowMiniaturizeButton forStyleMask:window.styleMask];
NSButton *closeButton = [NSWindow standardWindowButton:NSWindowCloseButton forStyleMask:window.styleMask];
NSButton *fullScreenButton = [NSWindow standardWindowButton:NSWindowZoomButton forStyleMask:window.styleMask];


//set their location
[closeButton setFrame:CGRectMake(7+70, window.frame.size.height - 22 - 52, closeButton.frame.size.width, closeButton.frame.size.height)];
[fullScreenButton setFrame:CGRectMake(47+70, window.frame.size.height - 22 -52, fullScreenButton.frame.size.width, fullScreenButton.frame.size.height)];
[minitButton setFrame:CGRectMake(27+70, window.frame.size.height - 22 - 52, minitButton.frame.size.width, minitButton.frame.size.height)];

//add them to the window
[window.contentView addSubview:closeButton];
[window.contentView addSubview:fullScreenButton];
[window.contentView addSubview:minitButton];
Run Code Online (Sandbox Code Playgroud)

现在当窗口出现时带有按钮有两个问题:1.它们是灰色而不是正确的颜色2.当鼠标悬停在它们上面时,它们不显示+ - 或x符号

任何人都可以告诉我我做错了什么.谢谢.

macos cocoa objective-c nswindow nsbutton

11
推荐指数
2
解决办法
4647
查看次数

iTunes连接 - 无法添加用户 - 未发送邀请电子邮件

当我在iTunes Connect>用户和角色> iTunes中添加用户时连接用户> +(添加用户)

Itunes connect说"已经发送了一个verificartion电子邮件给..."(见截图),但从未收到电子邮件(即使在垃圾邮件文件夹中).我无法将用户添加到我的itunes连接中,因为他们无法激活他们的帐户.

我尝试的任何电子邮件都会出现此问题(包括新创建的没有iTunes帐户)

有没有人知道解决这个问题的方法或为什么会发生这种情况?

在此输入图像描述

itunesconnect testflight

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

Facebook图形API搜索https://graph.facebook.com/search?q=query&type=user有两个关键字

如果我执行Facebook图形api搜索,例如:

https://graph.facebook.com/search?q=query&type=user
Run Code Online (Sandbox Code Playgroud)

查询只是一个单词,如'马克',一切都很好,有结果.但是,如果查询是两个单词,例如'Mark Roberts',则不会返回任何结果.

我曾尝试使用'Mark + Roberts',并尝试使用带有转义的URL编码,但这没有用.但是,当我使用两个关键字并删除&type = user时,我会得到结果(尽管有大量随机的facebook内容).

所以:

https://graph.facebook.com/search?q=mark&type=user   < WORKS

https://graph.facebook.com/search?q=mark+robers&type=user   < DOES NOT WORK

https://graph.facebook.com/search?q=mark+robers  < WORKS (but does not return people)
Run Code Online (Sandbox Code Playgroud)

有没有人遇到过这个问题?

Facebook似乎没有提及任何相关内容:http://developers.facebook.com/docs/reference/api/search/

注意:我当然正在使用经过身份验证的APP ID并登录用户等.

sdk facebook facebook-graph-api

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