Initial use of Bmob and use of Bmob

Source: Internet
Author: User

Initial use of Bmob and use of Bmob
Register a Bmob account

Enter www.bmob.cn in the URL bar or enter Bmob in Baidu for search. Open the Bmob official website and click "register" in the upper right corner. enter your name, email address, and password on the jump page, after confirmation, activate your Bmob account in your mailbox, and you can use Bmob to easily develop applications.


Create an application on the website background

Log on to the bmob background, click "create application" in the upper-left corner of the background interface, enter the name of your application in the pop-up box, and then confirm that you have an application waiting for development.


Get app key and download SDK

Select the application you want to develop and click the corresponding "application key" below the application"




After the import, the results are as follows:


Set BmobKey of the application


One test: one test for uploading name, password, and image

Create a button Association event:

UIButton * button = [UIButton buttonWithType: UIButtonTypeSystem]; [button setTitle: @ "send" forState: UIControlStateNormal]; button. bounds = CGRectMake (0, 0,200, 30); button. center = self. view. center; [button addTarget: self action: @ selector (buttonPressed :) forControlEvents: UIControlEventTouchUpInside]; [self. view addSubview: button];

- (void)buttonPressed:(UIButton *)sender {    [self createBmobObject];//    [self addUserInfo];}

-(Void) createBmobObject {// Add a playerName for the GameScore table BmobObject * gameScore = [BmobObject objectWithClassName: @ "UserInformation"]; [gameScore setObject: @ "Your name" forKey: @ "name"]; [gameScore setObject: @ "123" forKey: @ "password"]; [gameScore saveInBackgroundWithResultBlock: ^ (BOOL isSuccessful, NSError * error) {if (isSuccessful) {NSLog (@ "success");} else {NSLog (@ "failed") ;}}]; NSBundle * bundle = [NSBundle mainBundle]; // NSString * fileString = [NSString stringWithFormat: @ "% @/image1.jpg", [bundle bundlePath]; bmobFile * file = [[BmobFile alloc] initWithFilePath: fileString]; [file saveInBackground: ^ (BOOL failed, NSError * error) {if (isSuccessful) {[gameScore setObject: file forKey: @ "logImage"]; [gameScore updateInBackground]; NSLog (@ "successful") ;}} withProgressBlock: ^ (float progress) {}];}

Effect:




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.