Skip to content

Commit

Permalink
Merge pull request #98 from olgadanylova/40b3To40b5
Browse files Browse the repository at this point in the history
4.0b3 to 4.0b5
  • Loading branch information
Olga Danylova authored Apr 28, 2017
2 parents e720fa1 + 49bfcba commit 6f40398
Show file tree
Hide file tree
Showing 18 changed files with 186 additions and 211 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Backendless SDK for iOS (http://backendless.com)
---

# Version 4.0 Beta 4
# Version 4.0 Beta 5
> For the instructions for version 3.x of the library, see [Backendless 3.x Getting Started Guide](https://backendless.com/mobile-developers/quick-start-guide-for-ios/ "Backendless 3.x Getting Started Guide")
## GETTING STARTED WITH BACKENDLESS
Expand All @@ -28,15 +28,19 @@ To create a new project with CocoaPods, follow the instructions below:
3. Create a Podfile. This can be done by running `pod init`.
4. Open your Podfile with a text editor, and add the following
```
pod 'Backendless', '4.0b4'
pod 'Backendless', '4.0b5'
```
5. Save Podfile, return to Terminal window and run `pod install`. Once all of the pod data is downloaded, Xcode project workspace file will be created. This is the file you must open when working on your app.
5. Save Podfile, return to Terminal window and run `pod install` and `pod update`. Once all of the pod data is downloaded/updated, Xcode project workspace file will be created. This is the file you must open when working on your app.
6. Open .xcworkspace file to launch your project.
7. If you use Swift, it is necessary to add a bridging header file. Navigate to "Build Settings -> Swift Compiler ... -> Objective-C Bridgeing Header" and add the following:
`${PODS_ROOT}/Headers/Public/Backendless/Backendless-Bridging-Header.h`

## RELEASE HISTORY
4.0b5 April 28, 2017
* Bug fixes

4.0b4 April 25, 2017

* Fixed and cleaned up register device methods in Messaging
* Removed unregister device methods with IResponder
* Cleaned up Subscribe methods in Messaging
Expand Down
8 changes: 4 additions & 4 deletions SDK/backendlessAPI/Classes/Backendless.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
* *********************************************************************************************************************
*
* BACKENDLESS.COM CONFIDENTIAL
*
*
* ********************************************************************************************************************
*
*
* Copyright 2012 BACKENDLESS.COM. All Rights Reserved.
*
*
* NOTICE: All information contained herein is, and remains the property of Backendless.com and its suppliers,
* if any. The intellectual and technical concepts contained herein are proprietary to Backendless.com and its
* suppliers and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret
* or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden
* unless prior written permission is obtained from Backendless.com.
*
*
* ********************************************************************************************************************
*/

Expand Down
56 changes: 27 additions & 29 deletions SDK/backendlessAPI/Classes/Files/FileService.m
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,25 @@ @implementation AsyncResponse
@synthesize connection, receivedData, responseUrl, responder;

-(id)init {
if ( (self=[super init]) ) {
if ( (self=[super init]) ) {
connection = nil;
receivedData = nil;
responseUrl = nil;
responder = nil;
}
return self;
}
return self;
}

-(void)dealloc {
[DebLog logN:@"DEALLOC AsyncResponse"];
[DebLog logN:@"DEALLOC AsyncResponse"];

[receivedData release];
[responseUrl release];
[responder release];
[super dealloc];
[super dealloc];
}

@end
Expand All @@ -102,22 +102,22 @@ -(void)processAsyncResponse:(NSURLConnection *)connection;
@implementation FileService

-(id)init {
if ( (self=[super init]) ) {
if ( (self=[super init]) ) {

[[Types sharedInstance] addClientClassMapping:@"com.backendless.services.persistence.NSArray" mapped:[NSArray class]];
[[Types sharedInstance] addClientClassMapping:@"com.backendless.management.files.FileDetailedInfo" mapped:BEFileInfo.class];
[[Types sharedInstance] addClientClassMapping:@"com.backendless.management.files.FileInfo" mapped:BEFileInfo.class];

asyncResponses = [NSMutableArray new];
_permissions = [FilePermission new];
}
return self;
}
return self;
}

-(void)dealloc {
[DebLog log:@"DEALLOC FileService"];
[DebLog log:@"DEALLOC FileService"];

[NSObject cancelPreviousPerformRequestsWithTarget:self];

Expand All @@ -126,7 +126,7 @@ -(void)dealloc {

[_permissions release];

[super dealloc];
[super dealloc];
}


Expand All @@ -144,7 +144,7 @@ -(id)remove:(NSString *)fileURL {

-(id)removeDirectory:(NSString *)path {
if (!path || !path.length)
return [backendless throwFault:FAULT_NO_DIRECTORY_PATH];
return [backendless throwFault:FAULT_NO_DIRECTORY_PATH];
NSArray *args = [NSArray arrayWithObjects:path, nil];
return [invoker invokeSync:SERVER_FILE_SERVICE_PATH method:METHOD_DELETE args:args];
}
Expand All @@ -159,7 +159,7 @@ -(BackendlessFile *)saveFile:(NSString *)path fileName:(NSString *)fileName cont
if (!fileName || !fileName.length)
return [backendless throwFault:FAULT_NO_FILE_NAME];
if (!content || !content.length)
return [backendless throwFault:FAULT_NO_FILE_DATA];
return [backendless throwFault:FAULT_NO_FILE_DATA];
NSArray *args = @[path, fileName, content, @(overwrite)];
NSString *receiveUrl = [invoker invokeSync:SERVER_FILE_SERVICE_PATH method:METHOD_SAVE_FILE args:args];
return [BackendlessFile file:receiveUrl];
Expand All @@ -186,7 +186,7 @@ -(NSString *)renameFile:(NSString *)oldPathName newName:(NSString *)newName {
if (!oldPathName || !oldPathName.length)
return [backendless throwFault:FAULT_NO_DIRECTORY_PATH];
if (!newName || !newName.length)
return [backendless throwFault:FAULT_NO_FILE_NAME];
return [backendless throwFault:FAULT_NO_FILE_NAME];
NSArray *args = @[oldPathName, newName];
return [invoker invokeSync:SERVER_FILE_SERVICE_PATH method:METHOD_RENAME_FILE args:args];
}
Expand Down Expand Up @@ -219,7 +219,7 @@ -(NSArray *)listing:(NSString *)path pattern:(NSString *)pattern recursive:(BOOL

-(NSNumber *)exists:(NSString *)path {
if (!path || !path.length)
return [backendless throwFault:FAULT_NO_DIRECTORY_PATH];
return [backendless throwFault:FAULT_NO_DIRECTORY_PATH];
NSArray *args = @[path];
return [invoker invokeSync:SERVER_FILE_SERVICE_PATH method:METHOD_EXISTS args:args];
}
Expand All @@ -228,7 +228,7 @@ -(NSNumber *)getFileCount:(NSString *)path pattern:(NSString *)pattern recursive
if (!path || !path.length)
return [backendless throwFault:FAULT_NO_DIRECTORY_PATH];
if (!pattern || !pattern.length)
return [backendless throwFault:FAULT_NO_PATTERN];
return [backendless throwFault:FAULT_NO_PATTERN];
NSArray *args = @[path, pattern, @(recursive), @(countDirectories)];
return [invoker invokeSync:SERVER_FILE_SERVICE_PATH method:METHOD_COUNT args:args];
}
Expand Down Expand Up @@ -264,7 +264,7 @@ -(void)saveFile:(NSString *)filePathName content:(NSData *)content overwriteIfEx
if (!filePathName || !filePathName.length)
return [responder errorHandler:FAULT_NO_FILE_NAME];
if (!content|| !content.length)
return [responder errorHandler:FAULT_NO_FILE_DATA];
return [responder errorHandler:FAULT_NO_FILE_DATA];
NSArray *args = @[filePathName, content, @(overwrite)];
Responder *_responder = [Responder responder:self selResponseHandler:@selector(saveFileResponse:) selErrorHandler:nil];
_responder.chained = responder;
Expand All @@ -285,7 +285,7 @@ -(void)getFileCount:(NSString *)path pattern:(NSString *)pattern recursive:(BOOL
if (!path || !path.length)
return [responder errorHandler:FAULT_NO_DIRECTORY_PATH];
if (!pattern || !pattern.length)
return [responder errorHandler:FAULT_NO_PATTERN];
return [responder errorHandler:FAULT_NO_PATTERN];
NSArray *args = @[path, pattern, @(recursive), @(countDirectories)];
[invoker invokeAsync:SERVER_FILE_SERVICE_PATH method:METHOD_COUNT args:args responder:responder];
}
Expand Down Expand Up @@ -337,15 +337,15 @@ -(void)renameFile:(NSString *)oldPathName newName:(NSString *)newName response:(
-(void)copyFile:(NSString *)sourcePathName target:(NSString *)targetPathName response:(void(^)(NSString *))responseBlock error:(void(^)(Fault *))errorBlock {
id<IResponder>responder = [ResponderBlocksContext responderBlocksContext:responseBlock error:errorBlock];
if (!sourcePathName || !sourcePathName.length || !targetPathName || !targetPathName.length)
return [responder errorHandler:FAULT_NO_DIRECTORY_PATH];
return [responder errorHandler:FAULT_NO_DIRECTORY_PATH];
NSArray *args = @[sourcePathName, targetPathName];
[invoker invokeAsync:SERVER_FILE_SERVICE_PATH method:METHOD_COPY_FILE args:args responder:responder];
}

-(void)moveFile:(NSString *)sourcePathName target:(NSString *)targetPathName response:(void(^)(NSString *))responseBlock error:(void(^)(Fault *))errorBlock {
id<IResponder>responder = [ResponderBlocksContext responderBlocksContext:responseBlock error:errorBlock];
if (!sourcePathName || !sourcePathName.length || !targetPathName || !targetPathName.length)
return [responder errorHandler:FAULT_NO_DIRECTORY_PATH];
return [responder errorHandler:FAULT_NO_DIRECTORY_PATH];
NSArray *args = @[sourcePathName, targetPathName];
[invoker invokeAsync:SERVER_FILE_SERVICE_PATH method:METHOD_MOVE_FILE args:args responder:responder];
}
Expand All @@ -371,14 +371,14 @@ -(void)getFileCount:(NSString *)path pattern:(NSString *)pattern recursive:(BOOL
}

-(void)getFileCount:(NSString *)path pattern:(NSString *)pattern recursive:(BOOL)recursive response:(void(^)(NSNumber *))responseBlock error:(void(^)(Fault *))errorBlock {
[self getFileCount:path pattern:pattern recursive:recursive countDirectories:NO responder:[ResponderBlocksContext responderBlocksContext:responseBlock error:errorBlock]];
[self getFileCount:path pattern:pattern recursive:recursive countDirectories:NO responder:[ResponderBlocksContext responderBlocksContext:responseBlock error:errorBlock]];
}

-(void)getFileCount:(NSString *)path pattern:(NSString *)pattern response:(void(^)(NSNumber *))responseBlock error:(void(^)(Fault *))errorBlock {
[self getFileCount:path pattern:pattern recursive:NO countDirectories:NO responder:[ResponderBlocksContext responderBlocksContext:responseBlock error:errorBlock]];
[self getFileCount:path pattern:pattern recursive:NO countDirectories:NO responder:[ResponderBlocksContext responderBlocksContext:responseBlock error:errorBlock]];
}

-(void)getFileCount:(NSString *)path response:(void(^)(NSNumber *))responseBlock error:(void(^)(Fault *))errorBlock {
-(void)getFileCount:(NSString *)path response:(void(^)(NSNumber *))responseBlock error:(void(^)(Fault *))errorBlock {
[self getFileCount:path pattern:@"*" recursive:NO countDirectories:NO responder:[ResponderBlocksContext responderBlocksContext:responseBlock error:errorBlock]];
}

Expand Down Expand Up @@ -507,5 +507,3 @@ -(void)connectionDidFinishLoading:(NSURLConnection *)connection {
}

@end


28 changes: 14 additions & 14 deletions SDK/backendlessAPI/Classes/Geo/GeoService.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ -(id)getError:(id)error;
@implementation GeoService

-(id)init {
if ( (self=[super init]) ) {
if ( (self=[super init]) ) {
[[Types sharedInstance] addClientClassMapping:@"com.backendless.geo.model.GeoCategory" mapped:[GeoCategory class]];
[[Types sharedInstance] addClientClassMapping:@"com.backendless.geo.model.GeoPoint" mapped:[GeoPoint class]];
[[Types sharedInstance] addClientClassMapping:@"com.backendless.geo.model.GeoCluster" mapped:[GeoCluster class]];
Expand All @@ -90,17 +90,17 @@ -(id)init {
[[Types sharedInstance] addClientClassMapping:@"com.backendless.services.persistence.NSArray" mapped:[NSArray class]];
[[Types sharedInstance] addClientClassMapping:@"com.backendless.geofence.model.GeoFenceAMF" mapped:[GeoFence class]];
_presence = [Presence new];
}
return self;
}
return self;
}

-(void)dealloc {
[DebLog logN:@"DEALLOC GeoService"];
[DebLog logN:@"DEALLOC GeoService"];

[_presence release];
[super dealloc];

[super dealloc];
}


Expand Down Expand Up @@ -150,7 +150,7 @@ -(NSArray *)getPoints:(BackendlessGeoQuery *)query {
if ([result isKindOfClass:[Fault class]]) {
return result;
}

if (![result isKindOfClass:[NSArray class]]) {

NSLog(@"GeoService->getPoints: (ERROR) [%@]\n%@", [result class], result);
Expand Down Expand Up @@ -247,7 +247,7 @@ -(GeoPoint *)loadMetadata:(GeoPoint *)geoPoint {
id fault = nil;
if ((fault = [self isFaultGeoPoint:geoPoint responder:nil]) || (fault = [self isFaultGeoPointId:geoPoint.objectId responder:nil]))
return fault;

id query = [geoPoint isKindOfClass:[GeoCluster class]]? [(GeoCluster *)geoPoint geoQuery] : [NSNull null];
NSArray *args = @[geoPoint.objectId, query];
[geoPoint metadata:[invoker invokeSync:SERVER_GEO_SERVICE_PATH method:METHOD_LOAD_METADATA args:args]];
Expand Down Expand Up @@ -321,7 +321,7 @@ -(NSNumber *)getGeopointCount:(BackendlessGeoQuery *)query {

NSArray *args = @[query];
return [invoker invokeSync:SERVER_GEO_SERVICE_PATH method:METHOD_COUNT args:args];

}

-(NSNumber *)getGeopointCount:(NSString *)geoFenceName query:(BackendlessGeoQuery *)query {
Expand Down Expand Up @@ -418,7 +418,7 @@ -(void)removePoint:(GeoPoint *)geoPoint responder:(id<IResponder>)responder {

if ([self isFaultGeoPoint:geoPoint responder:responder] || [self isFaultGeoPointId:geoPoint.objectId responder:responder])
return;

NSArray *args = [NSArray arrayWithObjects:geoPoint.objectId, nil];
[invoker invokeAsync:SERVER_GEO_SERVICE_PATH method:METHOD_DELETE_GEOPOINT args:args responder:responder];
}
Expand Down Expand Up @@ -779,11 +779,11 @@ -(id)getResponse:(ResponseContext *)response {

NSArray *collection = response.response;
BackendlessGeoQuery *geoQuery = response.context;
// collection.query = geoQuery;
// collection.query = geoQuery;
[collection type:[GeoPoint class]];

[self setReferenceToCluster:collection];

return collection;
}

Expand All @@ -796,7 +796,7 @@ -(id)getMetadata:(ResponseContext *)response {
}

-(id)getGeoFences:(ResponseContext *)response {

id geoFences = response.response;
id <ICallback> callback = response.context;
[self addFenceMonitoring:callback geoFences:geoFences];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ -(NSArray *)find {

-(NSArray *)find:(DataQueryBuilder *)queryBuilder {
NSArray *args = @[_tableName, [queryBuilder build]];
id result = [invoker invokeSync:_SERVER_PERSISTENCE_SERVICE_PATH method:@"" args:args];
id result = [invoker invokeSync:_SERVER_PERSISTENCE_SERVICE_PATH method:@"find" args:args];
if ([result isKindOfClass:[Fault class]]) {
return result;
}
Expand Down
24 changes: 1 addition & 23 deletions SDK/backendlessAPI/Classes/UserService/UserService.m
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ -(BackendlessUser *)update:(BackendlessUser *)user {
if (_isStayLoggedIn && _currentUser && [user.objectId isEqualToString:_currentUser.objectId]) {
[self updateCurrentUser:result];
}
#endif
#endif
return user;
}

Expand Down Expand Up @@ -737,33 +737,12 @@ -(id)onValidUserTokenFault:(Fault *)fault {
@implementation UserService (SafariVC)

-(UIViewController *)getCurrentViewController {


/*
// source: Parse -> PFAlertView.m
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
UIViewController *viewController = keyWindow.rootViewController;
while (viewController.presentedViewController) {
viewController = viewController.presentedViewController;
}
return viewController;
*/

UIViewController *WindowRootVC = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
UIViewController *currentViewController = [self findTopViewController:WindowRootVC];

return currentViewController;
}

-(UIViewController *)findTopViewController:(UIViewController *)inController {
/* if ur using any Customs classes, do like this.
* Here SlideNavigationController is a subclass of UINavigationController.
* And ensure you check the custom classes before native controllers , if u have any in your hierarchy.
if ([inController isKindOfClass:[SlideNavigationController class]])
{
return [self findTopViewController:[inController visibleViewController]];
}
else */
if ([inController isKindOfClass:[UITabBarController class]]) {
return [self findTopViewController:[(UITabBarController *)inController selectedViewController]];
}
Expand All @@ -786,4 +765,3 @@ -(void)safariViewControllerDidFinish:(SFSafariViewController *)controller {
@end
#endif
#endif

Loading

0 comments on commit 6f40398

Please sign in to comment.