(Optional) To update application settings, for both the client and the SAP Mobile Platform Server, use OData SDK.
//////Get settings SMPAppSettings *l_appsettingsObj = [SMPAppSettings initializeWithConnection:l_clientconn userName:UserName password:Password]; NSDictionary *dct=[l_appsettingsObj getConfigPropertyMapWithError:&error]; NSLog(@"Properties - %@",dct); //Update settings SMPAppSettings *l_appsettingsObj = [SMPAppSettings initializeWithConnection:l_clientconn userName:rrUserName password:rrUserName]; NSMutableDictionary *dct=[NSMutableDictionary dictionary]; ////////SET APNS device token///////// NSString *token; if (deviceToken1 != nil) { token = [NSString stringWithFormat:@"%@",deviceToken1]; token = [token stringByReplacingOccurrencesOfString:@"<" withString:@""]; token = [token stringByReplacingOccurrencesOfString:@">" withString:@""]; }else token = @""; [dct setValue:token forKey:@"d:ApnsDeviceToken"]; [dct setValue:@"1.0" forKey:@"d:ApplicationVersion"]; [dct setValue:@"true" forKey:@"d:CapabilitiesPasswordPolicy"]; [dct setValue:@"Custom 1" forKey:@"d:CustomCustom1"]; [dct setValue:@"Custom 2" forKey:@"d:CustomCustom2"]; [dct setValue:@"Custom 3" forKey:@"d:CustomCustom3"]; [dct setValue:@"Custom 5" forKey:@"d:CustomCustom4"]; [dct setValue:@"9876512345abcdefgh" forKey:@"d:DeviceIMSI"]; [dct setValue:@"5" forKey:@"d:DeviceModel"]; [dct setValue:@"100" forKey:@"d:DevicePhoneNumber"]; [dct setValue:@"6.1" forKey:@"d:DeviceSubType"]; [dct setValue:@"iPhone" forKey:@"d:DeviceType"]; // [dct setValue:@"" forKey:@""]; NSError *error; BOOL setPropError=[l_appsettingsObj setConfigProperty:dct error:&error]; if(setPropError){ NSLog(@"Set User Property failed with error message - %@. \n Following are the properties values sent to the server:- \n %@", error, dct); }else{ NSLog(@"Set User Property completed without any error. \n Following are the properties values sent to the server:- \n %@", dct);
(Optional) Download customization resource bundles as defined in SAP Mobile Platform Serverusing the following example code:
NSError* _errorWhileFetchingID = nil; SMPAppSettings *appSettings = [SMPAppSettings initializeWithConnection:l_clientconn userName:UserName password:Password]; NSString *bundleId = [appSettings getConfigProperty:@"d:CustomizationBundleId" error:&_errorWhileFetchingID]; if (!_errorWhileFetchingID) { NSError* _errorWhileFetchingBundle=nil; NSData* bundle = [appSettings getCustomizationResourceBundleWithCustomizationResource:bundleId error:&_errorWhileFetchingBundle]; } //bundleId can be set to bundle name (fetches the specified bundle) or nil (fetches the default bundle selected)
NSString* pushEndpoint = [appSettings getPushEndpointWithError:nil];