2
0

Fixed importing with a different key and entity access after MOC changes.

[FIXED]   Importing stored content when not logged in with the same key.
[FIXED]   Holding entities is a bad idea when MOCs can change.  Holding ObjectIDs instead now.
This commit is contained in:
Maarten Billemont 2012-08-18 15:37:24 +02:00
parent d429044f64
commit 479d357bd1
5 changed files with 26 additions and 11 deletions

View File

@ -26,9 +26,9 @@
*
**/
#ifdef DEBUG
#define CLS_LOG(__FORMAT__, ...) CLSNSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#define CLS_LOG(__FORMAT__, ...) CLSNSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define CLS_LOG(__FORMAT__, ...) CLSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#define CLS_LOG(__FORMAT__, ...) CLSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
/**
@ -37,15 +37,15 @@
* and will only be visible in your Crashlytics dashboard.
*
**/
void CLSLog(NSString *format, ...);
OBJC_EXTERN void CLSLog(NSString *format, ...);
/**
*
* Add logging that will be sent with your crash data. This logging will show up in the system.log
* and your Crashlytics dashboard. It is not reccomended for Release builds.
* and your Crashlytics dashboard. It is not recommended for Release builds.
*
**/
void CLSNSLog(NSString *format, ...);
OBJC_EXTERN void CLSNSLog(NSString *format, ...);
@protocol CrashlyticsDelegate;

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.1.5</string>
<string>1.1.7</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
@ -25,7 +25,7 @@
<string>iPhoneOS</string>
</array>
<key>CFBundleVersion</key>
<string>0101.05.00</string>
<string>0101.07.00</string>
<key>CrashlyticsAPIKey</key>
<string>0d10c90776f5ef5acd01ddbeaca9a6cba4814560</string>
<key>DTCompiler</key>

View File

@ -7,12 +7,16 @@
//
#import "MPAppDelegate_Shared.h"
#import "MPAppDelegate_Store.h"
@interface MPAppDelegate_Shared ()
@property (strong) NSManagedObjectID *activeUserID;
@end
@implementation MPAppDelegate_Shared
@synthesize key;
@synthesize activeUser;
+ (MPAppDelegate_Shared *)get {
#if TARGET_OS_IPHONE
@ -41,4 +45,14 @@
#endif
}
- (MPUserEntity *)activeUser {
return (MPUserEntity *)[self.managedObjectContextIfReady objectWithID:self.activeUserID];
}
- (void)setActiveUser:(MPUserEntity *)activeUser {
self.activeUserID = activeUser.objectID;
}
@end

View File

@ -185,6 +185,7 @@
if (!key)
return;
assert([key.keyID isEqualToData:self.user.keyID]);
[self setContent:content usingKey:key];
}
@ -209,7 +210,7 @@
- (void)setContent:(id)content usingKey:(MPKey *)key {
assert(self.type & MPElementTypeClassStored);
assert([key.keyID isEqualToData:self.user.keyID]);
assert(key);
NSData *encryptedContent = [[content description] encryptWithSymmetricKey:[key subKeyOfLength:PearlCryptKeySize].keyData padding:YES];