Skip to content

Instantly share code, notes, and snippets.

@ChrisRisner
Last active December 15, 2015 12:29
Show Gist options
  • Save ChrisRisner/5260966 to your computer and use it in GitHub Desktop.
Save ChrisRisner/5260966 to your computer and use it in GitHub Desktop.
FeedbackService
public void insertFeedback(Feedback feedback, TableOperationCallback<Feedback> callback) {
mFeedbackTable.insert(feedback, callback);
}
- (void) saveFeedback:(NSDictionary *)feedback
completion:(CompletionBlock) completion {
[self.feedbackTable insert:feedback completion:^(NSDictionary *result, NSError *error) {
[self logErrorIfNotNil:error];
completion();
}];
}
public FeedbackService(Context context) {
mContext = context;
try {
mClient = new MobileServiceClient("https://<YourMobileServiceUrl>.azure-mobile.net/", "<YourApplicationKey>", mContext);
mFeedbackTable = mClient.getTable(Feedback.class);
} catch (MalformedURLException e) {
Log.e(TAG, "There was an error creating the Mobile Service. Verify the URL");
}
}
-(FeedbackService *) init {
// Initialize the Mobile Service client with your URL and key
MSClient *newClient = [MSClient clientWithApplicationURLString:@"https://<YourMobileServiceUrl>.azure-mobile.net/"
withApplicationKey:@"<YourApplicationKey>"];
// Add a Mobile Service filter to enable the busy indicator
self.client = [newClient clientwithFilter:self];
self.feedbackTable = [_client getTable:@"Feedback"];
self.busyCount = 0;
return self;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment