Skip to content
No description, website, or topics provided.
Objective-C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ProjectNingIOS.xcodeproj
ProjectNingIOS
ProjectNingIOSTests
.gitignore
LICENSE
README.md

README.md

ProjectNingIOS

SDK project and a sample app built over the SDK.

To use this SDK, please import PNService.h in your .h file to access all the methodes in the SDK.

Users

Current user

Current user can be accessed any time by calling this method.

PNUser *user = [PNUser currentUser];

Several properties can also be accessed by calling the following methods on an user object.

[user username]
[user emailConfirmed]
[user expDate]
[user accessToken]

This method can be used to check if there is currently a logged in user or not. It will return nil if there is, or a NSError with a friendly error message.

[PNUser checkUserLoginStatus]

Register

Calling the flowwing method will request a registration from the server.

[PNUser registerUserWithUsername:@"something@domain.com"
                     andPassword:@"password"
                        response:^(PNUser *user, NSError *error) {
}];

Inside the response call back, either user or error is nil. So you can check the registration result by looking at either of them. Almost all the error message are human friendly. So you can just pop up the localized description of the error like this.

[error localizedDescription]

If the error is nil. the register process is completed. You can then do whatever you want in your app, probably segue to the next page.

Login

Calling the flowwing method will request a registration from the server.

[PNUser loginUserWithUsername:@"something@domain.com"
                  andPassword:@"password"
                    response:^(PNUser *user, NSError *error) {
}];

The result checking are the same as register process.

Log out

Calling the following method will logout the current user.

[PNUser logoutCurrentUser];

Images

Upload Image

The following method will upload an image without need of a title.

[PNImage uploadImage:UIImage
              inType:@"sampleImageType"
            response:^(NSError *error){
}];

The following method will upload an image with a user defined title.

[PNImage uploadImage:UIImage
              inType:@"sampleImageType"
           withTitle:@"sampleImageTitle"
            response:^(NSError *error){
}];

Note that these two image upload methods need a logged in user to upload. Also, the 'user defined' title is adjusted by the server for now.

Delete Image

The following method will delete an image on server by image id

[PNImage deleteImage:NSNumber
            response:^(NSError *error){
}];
You can’t perform that action at this time.