Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func sendLoginRequest(userName:String,password:String){
- let authenticate:String = String(format: "%@:%@", userName, password)
- let plainData = (authenticate as NSString).dataUsingEncoding(NSUTF8StringEncoding)
- let base64String = plainData!.base64EncodedStringWithOptions(NSDataBase64EncodingOptions(rawValue: 0))
- print(base64String)
- headers = ["Authorization" : String(format: "Basic %@", base64String)]
- self.webInterface = DFWebInterface.shareWebInterface(DFModel.sharedInstance.bMockServer)
- self.webInterface?.sendRequest(nil,request: LOGIN.rawValue, nil,headers: headers as! [NSObject : AnyObject])
- }
- -(id)init:(NSString*)strURL :(BOOL)mockServer{
- if(nil!=(sDFWebInterface=[super init])){
- NSURL *baseURL = [NSURL URLWithString:strURL];
- DFAFHTTPClient* client=[[DFAFHTTPClient alloc] initWithBaseURL:baseURL];
- sDFWebInterface->rkobjmanagerDF = [[RKObjectManager alloc] initWithHTTPClient:client];
- [RKMIMETypeSerialization registerClass:[RKNSJSONSerialization class] forMIMEType:@"text/plain"];
- [AFNetworkActivityIndicatorManager sharedManager].enabled = YES;
- }
- return sDFWebInterface;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement