GithubHelp home page GithubHelp logo

cloudmine / cloudminesdk-ios Goto Github PK

View Code? Open in Web Editor NEW
12.0 12.0 21.0 10.45 MB

CloudMine iOS SDK

Home Page: https://cloudmine.io/docs/#/ios

License: MIT License

Ruby 0.36% Makefile 0.36% Shell 0.33% Perl 24.86% Objective-C 74.09%

cloudminesdk-ios's People

Contributors

apbendi avatar ethanmick avatar geoffrey-young avatar keck avatar marcweil avatar nikkoschaff avatar readmecritic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloudminesdk-ios's Issues

mimeType not working on CMFile

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?

CustomUser class Terminating app

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.'

Build Script Fails on Lipo iPhoneSimulator - Need armv7s for iPhone 5

Xcode 4.5 with iOS 6.0

  1. I'm having issues with building, since the current framework doesn't include armv7s for iPhone 5. The script at the end fails when building the framework CloudMine target.

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

  1. There doesn't seem to be a Release-iphonesimulator folder in the build directory.

/Users/paulsolt/Library/Developer/Xcode/DerivedData/cm-ios-dkggtqfxpthmmoegxancdhyiolet/Build/Products/Release-iphoneos/libcloudmine.a

  1. The .framework is incomplete

CMDate does not deserialize correctly

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 ?

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];

Objects

{
    "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
            }
        },
    }
}

Cannot login with non-English locale.

Overview

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.

Steps to Reproduce

  1. Change the locale setting of iPhone to Japanese.
    "Settings" -> "General" -> "International" -> "Region Format" -> "Japanese (Japan)"
  2. Call loginWithCallback.
  3. When loginWithCallback succeeds, NSLog(@"isLoggedIn: %d", user.isLoggedIn);

Actual Results

isLoggedIn: 0

Expected Results

isLoggedIn: 1

Cause

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.

Fix

NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];

[dateFormatter setLocale:usLocale];

I can't get unreachable network error

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 ?

Swift: Update Docs/Example Repos with use of dynamic keyword

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?
}

DeviceTracker Bug

Fails to compile. Error with YAJL.

Updating and replacing the CloudMine.framework fixes the issue.

Adding a value to an object's array does not trigger it being dirty.

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

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"];
}

Can't get search count from CMObjectFetchResponse

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];
                }
            }

Can't get data from a snippet

CMWebService ignores all root level keys except "success" and "error" but snippets return in "result", making it difficult to request data from a snippet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.