小编Ani*_*eja的帖子

推送通知在iOS 9中无效

我已将设备升级到iOS 9,将Xcode环境升级到7.0 beta.推送通知在iOS 9中无效?

这是我的代码:

  float ver = [[[UIDevice currentDevice] systemVersion] floatValue];

    if(ver >= 8 && ver<9)
    {
        if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)])
        {
            [[UIApplication sharedApplication] registerForRemoteNotifications];
            UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil];
            [[UIApplication sharedApplication] registerUserNotificationSettings:settings];

        }
    }else if (ver >=9){

        [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];

        [[UIApplication sharedApplication] registerForRemoteNotifications];


    }
    else{
        //iOS6 and iOS7 specific code
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeAlert];
    }
Run Code Online (Sandbox Code Playgroud)

在使用Xcode 6.4构建的iOS 8到8.3上,推送通知正常工作.

push-notification apple-push-notifications ios9 xcode7

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

没有具有域权限的应用

我正在尝试通过通用链接集成深度链接。一切都在开发者帐户上很好地解决了。关联域也在应用 ID 上启用。

在服务器端 myapp.com/apple-app-site-association 可用。但是苹果搜索验证器总是抛出这个错误。

我不确定它到底是什么意思..?

如果有人可以帮助我,那就太好了。

谢谢

ios swift ios-universal-links

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

崩溃whille将NSURL转换为CFURL

我想在文档目录中创建pdf,并希望提供页码,所以我需要CGPDFDocumentRef对象.

let fileName: NSString = "test.pdf"

let path:NSArray = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)

let documentDirectory: AnyObject = path.objectAtIndex(0)

let pdfPathWithFileName = documentDirectory.stringByAppendingPathComponent(fileName as String)

UIGraphicsBeginPDFContextToFile(pdfPathWithFileName as String, CGRectZero, nil)

let ref : CGContextRef = UIGraphicsGetCurrentContext()!

let localUrl = NSURL.fileURLWithPath(pdfPathWithFileName)
Run Code Online (Sandbox Code Playgroud)

我已经在url中转换了文件路径,但这下面的行会导致崩溃,我不知道为什么......?

let pdfDocumentRef: CGPDFDocumentRef = CGPDFDocumentCreateWithURL(localUrl as CFURLRef)!
Run Code Online (Sandbox Code Playgroud)

nsurl ios cgcontextref swift

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

Branch.io 仅在设备中已存在应用程序时才重定向到应用程序商店

在我的其中一个应用程序中,我实现了 branch.io。

我已阅读所有内容并相应地结算了我的帐户。

现在我想从 branch.io 得到什么

1)如果应用程序存在于设备中,它应该在点击营销网址时打开。

2) 如果设备中不存在应用程序,则应重定向到应用程序商店应用程序页面。**

什么不起作用

1> 虽然应用程序存在,但它没有打开我的应用程序。从相同的 url 模式,我可以从 safari 浏览器“appname://”打开我的应用程序,但无法从 branch.io 的链接打开。它总是打开应用商店页面。

请帮我。

谢谢

iphone ios branch.io

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

条纹框架始终为卡品牌返回@ 1x图像

Stripe总是返回卡片品牌的@ 1x小图片.

我想要的是它应该根据设备分辨率选择它的@ 2x,@ 3x图像.

这是我的代码.

let cardBrand = STPCardValidator.brand(forNumber: cardNumber)
let cardImage = STPImageLibrary.brandImage(for: cardBrand)

self.IBImageViewCardType?.image = cardImage
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏.

提前致谢.

ios stripe-payments swift

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