小编Paw*_*weł的帖子

确定地理定位是否启用了本机响应

使用RN构建应用程序我使用以下内容来接收用户的位置:

 navigator.geolocation.getCurrentPosition(
  (position) => {
   //do stuff with location
  },
  (error) => {
    //error or locaiton not allowed
  },
  {enableHighAccuracy: true, timeout: 20000, maximumAge: 1000}
);
Run Code Online (Sandbox Code Playgroud)

其中立即调用用户的查询以接受地理定位权限.我现在想要实现的是在提示用户点击按钮接受这些权限之前有一个显式屏幕.为了实现这一目标,我需要一些方法来检查他是否已经接受了这些权限.在存储中缓存它将是一个糟糕的解决方案 - 如果用户更改设置中的权限,它可能会不同步.

如何在不触发权限警报的情况下检查用户是否已接受地理定位权限?

geolocation ios react-native

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

与核心数据的关系错误

(使用swift/Xcode beta 3)

我的项目中有两个实体 - 一个与其子项具有一对多关系的父实体.在保存上下文之前添加新对象时,一切正常.但是,在重新启动应用程序并再次获取父对象后,我收到了所有子项的"关系错误".这就是我保存上下文的方式:

 func saveContext () {
    var error: NSError? = nil
    let appDel:AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate
    let context =  appDel.managedObjectContext

    if context == nil {
        return
    }
    if !context.hasChanges {
        return
    }
    if context.save(&error) {
        return
    }

    println("Error saving context: \(error?.localizedDescription)\n\(error?.userInfo)")
    abort()
}
Run Code Online (Sandbox Code Playgroud)

我尝试更改includesSubentities = truesetReturnsObjectsAsFaults = false但它似乎没有帮助.Objective-C的"关系错误"问题的大多数答案似乎都使​​用了setRelationshipKeyPathsForPrefetching,但在Swift中使用它与NSFetchRequest似乎是不可能的.

有什么我想念的吗?

core-data relationship swift

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

临时分发Swift iOS应用程序

我有两个空的iOS单视图应用程序通过Xcode 6 beta 2编译为IPA.一个是Objective-C,第二个是Swift.它们都具有完全相同的代码签名设置.在使用测试飞行或曲棍球分发ad hoc时,Objective-C版本安装没有问题.Swift的一个错误是'当前无法下载应用'.

我在它上面运行了iPhone配置实用程序日志,这就是我得到的:

Jun 24 17:36:27  installd[3555] <Notice>: 0x2c1000 handle_install_for_ls: Install of "/var/mobile/Media/Downloads/-6680582027007079892/1462391056366119034" requested by itunesstored
Jun 24 17:36:29  installd[3555] <Notice>: 0x2c1000 MobileInstallationInstall_Server: Installing app com.MyApp.sTest
Jun 24 17:36:29  installd[3555] <Error>: 0x2c1000 verify_signer_identity: MISValidateSignatureAndCopyInfo failed for /var/tmp/install_staging.HEsTZS/foo_extracted/Payload/sTest.app/sTest: 0xe8008017
Jun 24 17:36:29  installd[3555] <Error>: 0x2c1000 do_preflight_verification: Could not verify executable at /var/tmp/install_staging.HEsTZS/foo_extracted/Payload/sTest.app
Jun 24 17:36:29  itunesstored[94] <Error>: 0x1ef7000 MobileInstallationInstallForLaunchServices: failed with -1
Jun 24 17:36:29  itunesstored[94] <Warning>: ERROR: MobileInstallationInstallForLaunchServices returned nil
Jun 24 17:36:29  lsd[3554] <Warning>: LaunchServices: installation …
Run Code Online (Sandbox Code Playgroud)

adhoc ios provisioning-profile swift xcode6

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

钥匙串+ adhoc分发

首先,我们正在开发一个目前使用Swift/Xcode 6.1 GM 2进行开发的iOS应用程序.

在临时分发应用程序时,我们遇到了一些令人困惑的钥匙串访问问题,并且在跟踪原因时遇到了问题.所有配置文件都与我们的应用程序的包名称匹配.我们使用TestFlight进行分发,虽然我不认为这是问题所在.

我们只是设法让它在没有安装应用程序的iOS 7设备上运行.没有一个iOS 8设备是临时工作的.我们在开始时得到的错误是25300(errSecItemNotFound),现在重置供应配置文件后,我们得到一个普通的0(两者都在保存加载时仍然没有数据可以检索).从Xcode部署dev构建时,一切都很完美.

我已经分离了我们使用的keychain包装器的代码:

import UIKit
import Security

let serviceIdentifier = "com.Test.KeychainTest"

let kSecClassValue = kSecClass as NSString
let kSecAttrAccountValue = kSecAttrAccount as NSString
let kSecValueDataValue = kSecValueData as NSString
let kSecClassGenericPasswordValue = kSecClassGenericPassword as NSString
let kSecAttrServiceValue = kSecAttrService as NSString
let kSecMatchLimitValue = kSecMatchLimit as NSString
let kSecReturnDataValue = kSecReturnData as NSString
let kSecMatchLimitOneValue = kSecMatchLimitOne as NSString

class KeychainManager {

class func setString(value: NSString, forKey: String) {
    self.save(serviceIdentifier, key: forKey, data: value) …
Run Code Online (Sandbox Code Playgroud)

xcode keychain swift ios8

5
推荐指数
0
解决办法
962
查看次数

使用 React Native 屏蔽视图过渡动画

我有原生 iOS 背景,最近开始使用 React Native。不久前,我用 Swift 实现了类似的视图转换:

在此输入图像描述

遵循本教程: 如何制作像 Ping 应用程序中一样的视图控制器过渡动画

我想知道是否可以使用 React Native 创建类似的东西。如果是,我应该如何处理?我只需要关于如何继续这个想法的提示和一些直觉。

谢谢!

ios react-native

5
推荐指数
0
解决办法
875
查看次数

RCTTextField不是RCTShadowView错误的后代

我目前正在使用RCTTextField来切换键盘.每当我点击TextField并且键盘应该切换时我得到以下内容:

ExceptionsManager.js:76 view <RCTShadowView: 0x7faa0dcc7e90; viewName: RCTTextField; 
reactTag: 125; frame: {{10, 7.5}, {304, 30}}> (tag #125) is not a descendant of <RCTShadowView: 0x7faa101d0af0; 
viewName: RCTView; reactTag: 18; frame: {{0, 0}, {315, 502}}> (tag #18)
Run Code Online (Sandbox Code Playgroud)

我不知道如何跟踪潜在的问题 - 在这里寻找更多的细节或方向.

谢谢!

javascript ios react-native

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