cloudmine / cloudminesdk-ios Goto Github PK
View Code? Open in Web Editor NEWCloudMine iOS SDK
Home Page: https://cloudmine.io/docs/#/ios
License: MIT License
CloudMine iOS SDK
Home Page: https://cloudmine.io/docs/#/ios
License: MIT License
If a CMObject subclass has a property that is a dictionary the property on the object returned from Cloudmine will have a class entry- which is probably shouldn't.
Looks like the CMFile is not passing the mimeType along to the server.
let file = CMFile(data: pdfData, named: "doc.pdf", mimeType: "application/pdf")
file.saveWithUser(user) { response in
...
}
I expect the file to be saved with mimeType on the server application/pdf
but it's stored with application/octet-stream
instead. Looking at the code it looks like the mimeType is never passed along. The docs reference being able to do this. Is there a work around?
I am trying to get it work like described in docs but its not working
CustomUser.h
#import <CloudMine/CloudMine.h>
@interface CustomUser : CMUser
@property (strong) NSString *name;
@property (strong) CMDate *birthday;
- (void)resetState;
@end
CustomUser.m
@implementation CustomUser
@synthesize name;
@synthesize birthday;
- (id)initWithCoder:(NSCoder *)aDecoder {
if (self = [super initWithCoder:aDecoder]) {
name = [aDecoder decodeObjectForKey:@"name"];
birthday = [aDecoder decodeObjectForKey:@"birthday"];
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
[super encodeWithCoder:aCoder];
[aCoder encodeObject:name forKey:@"name"];
[aCoder encodeObject:birthday forKey:@"birthday"];
}
- (void)resetState {
name = nil;
birthday = nil;
self.token = nil;
self.tokenExpiration = nil;
}
@end
CustomUser *user = [[CustomUser alloc] initWithEmail:@"[email protected]" andPassword:@"password"]; user.name = @"Derek"; user.birthday = [[CMDate alloc] init];
Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer < CustomUser 0x7ff8a36ed7e0> for the key path "name" from < CustomUser 0x7ff8a36ed7e0> because it is not registered as an observer.'
Xcode 4.5 with iOS 6.0
lipo: can't open input file: /Users/paulsolt/Library/Developer/Xcode/DerivedData/cm-ios-dkggtqfxpthmmoegxancdhyiolet/Build/Products/Release-iphonesimulator/libcloudmine.a (No such file or directory)
Command /bin/sh failed with exit code 1
/Users/paulsolt/Library/Developer/Xcode/DerivedData/cm-ios-dkggtqfxpthmmoegxancdhyiolet/Build/Products/Release-iphoneos/libcloudmine.a
Using NSKeyedUnarchiver/NSKeyedArchiver to save and retrieve a CMObject through NSData does not deserialize CMDate values correctly:
class DateTest: CMObject {
dynamic var visitDate:CMDate? = CMDate()
override init() {
super.init()
}
override init!(objectId theObjectId: String!) {
super.init(objectId: theObjectId)
}
override func encodeWithCoder(aCoder: NSCoder!) {
super.encodeWithCoder(aCoder)
aCoder.encodeObject(self.visitDate, forKey: "visitDate")
}
required init(coder aDecoder: NSCoder!) {
super.init(coder: aDecoder)
self.visitDate = aDecoder.decodeObjectForKey("visitDate") as? CMDate
// CMDate is always 2001-01-01 00:00:00 +0000 from NSData
}
}
How can I sort search by NSDate field on these following objects ?
I don't understand what I should set value to the SortByField on CMSortDescriptor.
Please tell me what I should set to.
CMSortDescriptor* sortDescriptor = [CMSortDescriptor emptyDescriptor];
[sortDescriptor sortByField:@"dateCreated.timestamp" direction:CMSortDescending];
{
"success": {
"i15903904": {
"__id__": "515903904",
"__class__": "CMHogeModel",
"title": "Fugafuga",
"dateCreated": {
"__class__": "datetime",
"timestamp": 1338542126.358654
}
},
"409988078": {
"__id__": "409988078",
"__class__": "CMHogeModel",
"title": "Poppopo",
"dateCreated": {
"__class__": "datetime",
"timestamp": 1338542126.358654
}
},
"472623028": {
"__id__": "472623028",
"__class__": "CMHogeModel",
"title": "Aodosdfsdo",
"dateCreated": {
"__class__": "datetime",
"timestamp": 1338542126.358654
}
},
}
}
When locale is ja_JP, the loginWithCallback method succeeds with CMUserAccountLoginSucceeded, but user.isLoggedIn returns false.
This results from usage of NSDateFormatter without setting en_US locale for parsing RFC 1123 format.
isLoggedIn: 0
isLoggedIn: 1
The loginWithCallback method does not set locale to NSDateFormatter when parsing expiration dates in RFC 1123 format sent from the server.
The NSDateFormatter expects Japanese day of week string (e.g. "月", "火") for "EEE" date format string, so that parsing expiration date fails with returning nil.
This makes isLoggedIn returning false.
NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
[dateFormatter setLocale:usLocale];
AFNetworking/Kiwi is not checked out when I do a git clone from the read-only link.
It doesn't seem to checkout, is there a second step?
If network is unreachable when I call API, I can't get NSError.
And, a callback API response (CMObjectFetchResponse *response) is nil.
I hope I get such as these error info.
2012-06-11 20:31:59.465 HOGE[16378:f803] *** Error occurred during object request: Error Domain=ASIHTTPRequestErrorDomain Code=1 "A connection failure occurred" UserInfo=0x8191060 {NSUnderlyingError=0x8195320 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 2.)", NSLocalizedDescription=A connection failure occurred}
Or, Is this behavior a specification ?
Was running into an issue where objects weren't updating when saving to the server. I managed to figure out that Swift doesn't support KVO out of the box: docs(see section Key-Value Observing
).
Long story short when using Swift with the cloudmine-ios library make sure to add dynamic
in objects that extend CMObject:
class MyClass: CMObject {
// the right way. changes to this property will be picked up by KVO, the object will be marked
// dirty and saved when calling #save() or #saveWithUser()
dynamic var myProperty: String?
// the wrong way. changes will not be picked up by KVO and the object will never be marked
// as dirty and saved correctly
var anotherProperty: String?
}
Fails to compile. Error with YAJL.
Updating and replacing the CloudMine.framework fixes the issue.
Todo doesn't compile due to submodules. Please include a note in the readme.md about "git submodule update --init"
if you have an object such as this:
{
values: [1,2,3,4,5],
otherdata: "data"
}
If this gets decoded into an object with these properties:
NSMutableArray * values;
NSString* otherdata;
doing something like [values addObject: [NSNumber numberWithInt:6]];
and then a save will not save the object.
App Crashing after sign in with CloudMine custom user class after upgrading to 1.7.11
2016-09-26 09:11:31.012 DiscoverFood[827:640922] +[CustomCMUser rt_properties]: unrecognized selector sent to class 0x105da5b30
2016-09-26 09:11:31.021 DiscoverFood[827:640922] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[CustomCMUser rt_properties]: unrecognized selector sent to class 0x105da5b30'
*** First throw call stack:
(
0 CoreFoundation 0x000000010692234b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010b64e21e objc_exception_throw + 48
2 CoreFoundation 0x0000000106991e74 +[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00000001068a7c15 ___forwarding___ + 1013
4 CoreFoundation 0x00000001068a7798 _CF_forwarding_prep_0 + 120
5 DiscoverFood 0x0000000105c9d589 -[CMUser executeBlockForAllUserDefinedProperties:] + 105
6 DiscoverFood 0x0000000105c9d85d -[CMUser registerAllPropertiesForKVO] + 125
7 DiscoverFood 0x0000000105c9d146 -[CMUser initWithEmail:andUsername:andPassword:] + 454
#import "CustomCMUser.h"
@implementation CustomCMUser
- (id)initWithCoder:(NSCoder *)aDecoder {
if (self = [super initWithCoder:aDecoder]) {
_object_id = [aDecoder decodeObjectForKey:CMInternalObjectIdKey];
_sessionToken = [aDecoder decodeObjectForKey:@"token"];
_sessionTokenExpiration = [aDecoder decodeObjectForKey:@"tokenExpiration"];
_lastIP = [aDecoder decodeObjectForKey:@"lastIP"];
_lastDevice = [aDecoder decodeObjectForKey:@"lastDevice"];
_lastDeviceOS = [aDecoder decodeObjectForKey:@"lastDeviceOS"];
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
[super encodeWithCoder:aCoder];
[aCoder encodeObject:_object_id forKey:@"object_id"];
[aCoder encodeObject:_sessionToken forKey:@"sessionToken"];
[aCoder encodeObject:_sessionTokenExpiration forKey:@"sessionTokenExpiration"];
[aCoder encodeObject:_lastIP forKey:@"lastIP"];
[aCoder encodeObject:_lastDevice forKey:@"lastDevice"];
[aCoder encodeObject:_lastDeviceOS forKey:@"lastDeviceOS"];
}
The SDK should not crash if the app happens to attempt save on a nil object.
The equality test in CMDate
can fail due to floating point rounding errors when compared to a normal NSDate
I hope to use a paging when search query.
I set CMPagingDescriptor#includeCount to YES;
But I can't get search count from CMObjectFetchResponse.
May be igonre count on CMWebService.
if (results) {
successes = [results objectForKey:@"success"];
if (!successes) {
successes = [NSDictionary dictionary];
}
errors = [results objectForKey:@"errors"];
if (!errors) {
errors = [NSDictionary dictionary];
}
snippetResult = [results objectForKey:@"result"];
if(!snippetResult) {
snippetResult = [NSDictionary dictionary];
}
meta = [results objectForKey:@"meta"];
if(!meta) {
meta = [NSDictionary dictionary];
}
}
CMWebService ignores all root level keys except "success" and "error" but snippets return in "result", making it difficult to request data from a snippet.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.