简体   繁体   English

应用商店中的钥匙串和更新出现问题

[英]issue with keychain and updates from app store

I am having a very frustrating error. 我有一个非常令人沮丧的错误。 I have tested for an app upgrade by first installing the previous version (1.0.1) and then running version (1.0.2). 我已经通过先安装先前版本(1.0.1),然后运行版本(1.0.2)来测试应用程序升级。 Everything worked fine. 一切正常。 I submitted the app and then I am getting issues people are getting crashes when they upgrade. 我提交了该应用程序,然后我遇到了一些问题,人们在升级时会崩溃。 I tried doing the same thing, which is installing the 1.0.1 and then install the binary on the app store, then it crashed. 我尝试做同样的事情,先安装1.0.1,然后在应用商店中安装二进制文件,然后崩溃。 I looked at the console and crash logs and I get this: 我查看了控制台和崩溃日志,并得到以下信息:

Jul  7 08:07:45 unknown MyApp[1429] <Warning>: KeychainUtils keychainValueForKey: - Error finding keychain value for key. Status code = -25300
Jul  7 08:07:45 unknown MyApp[1429] <Warning>: AccountSession readUserDataFromDisk - Error finding keychain value for key /var/mobile/Applications/997B32E7-6FFC-4696-9CAA-129BADE2FE64/Documents/instagram_json
Jul  7 08:07:45 unknown MyApp[1429] <Warning>: UISegmentedControlStyleBezeled is deprecated. Please use a different style.
Jul  7 08:07:45 unknown MyApp[1429] <Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: username)'
    *** First throw call stack:
    (0x33ee688f 0x367e7259 0x33ee6789 0x33ee67ab 0x33e5368b 0x14fd99 0x152319 0x1530bb 0x170299 0x3270ec59 0x32711817 0x354e7dfb 0x354e7cd0)
Jul  7 08:07:45 unknown UIKitApplication:com.firesnakelabs.pinstagram[0x14e4][1429] <Notice>: terminate called throwing an exception
> 

UPDATE: 更新:

I think I know what the issue is, on upgrade the filepath it was looking for is at: 我想我知道问题是什么,升级所需的文件路径位于:

/var/mobile/Applications/997B32E7-6FFC-4696-9CAA-129BADE2FE64/Documents/instagram_json

while before the upgrade (v1.0.1) the filepath of the keychain is at: 而在升级(v1.0.1)之前,钥匙串的文件路径位于:

/var/mobile/Applications/CEE344F7-4FE1-4455-BD6D-A4D6EAA4F5FE/Documents/instagram_json

and hence it can't find the key on the keychain now here's how I determine the filePath: 因此,它现在无法在钥匙串上找到钥匙,这是我确定filePath的方法:

- (NSString *)filePath {
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@_json", self.identifier]];
    return filePath;
}

I am just taking the first path that I found. 我只是走我发现的第一条路。 So how do I make the path consistent before and after upgrade or all the time? 那么,如何在升级前后或始终保持一致的路径?

I am basically using the filePath as the keychain name: 我基本上是使用filePath作为钥匙串名称:

[attributesDictionary setObject:filePath forKey:(id)kSecAttrAccount]; // Use the key as the account name

It's not entirely clear from your question, but it sounds like one of these builds is an ad hoc distributed build and the other an app store signed binary. 您的问题尚不完全清楚,但听起来其中一个版本是临时的分布式版本,另一个是应用程序商店签名的二进制版本。 If that's the case, the two will have different keychain values. 如果真是这样,那么两者将具有不同的钥匙串值。 The keychain is linked to the app's signing which differs between the two mechanisms. 钥匙串链接到应用程序的签名,这在两种机制之间有所不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM