This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// WebService.swift | |
// ArtCaller | |
// | |
// Created by Twistfuture on 6/9/15. | |
// Copyright (c) 2015 Twist. All rights reserved. | |
// | |
import Foundation | |
import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add text field in alert view controller | |
UIAlertController * alertController = [UIAlertController alertControllerWithTitle: @"Login" | |
message: @"Input username and password" | |
preferredStyle:UIAlertControllerStyleAlert]; | |
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { | |
textField.placeholder = @"name"; | |
textField.textColor = [UIColor blueColor]; | |
textField.clearButtonMode = UITextFieldViewModeWhileEditing; | |
textField.borderStyle = UITextBorderStyleRoundedRect; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// facebook login in swift 3.0 | |
// the following code into info.plist | |
<key>CFBundleURLTypes</key> | |
<array> | |
<dict> | |
<key>CFBundleURLSchemes</key> | |
<array> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add the following code in to info.plist | |
<key>CFBundleURLTypes</key> | |
<array> | |
<dict> | |
<key>CFBundleURLSchemes</key> | |
<array> | |
<string>fb1801381186770425</string> | |
</array> | |
</dict> | |
</array> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add the webview to your view controller add call web view delegate | |
// register your app into instagram | |
// add following code in to button action | |
let clientID = "aef611af2a1e4806a7de8c0aca13daac" | |
let redirect_uri = "http://weebook.in/" | |
let getAccessToken = "https://api.instagram.com/oauth/authorize/?client_id=\(clientID)&redirect_uri=\(redirect_uri)&response_type=token" | |
self.InstagramWebView.loadRequest(NSURLRequest(url: NSURL(string:getAccessToken as String)! as URL) as URLRequest) | |
// delegate function of weview |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)sendData:(NSString*)email : (NSString*)password :(NSString*)user_id : (NSString*)urlString : (NSString*)name { | |
NSLog(@"sendData"); | |
NSURL *url = [NSURL URLWithString:urlString]; | |
NSMutableURLRequest * urlRequest = [NSMutableURLRequest requestWithURL:url]; | |
NSString *dataString = [NSString stringWithFormat:@"email=%@&password=%@&id=%@",email,password,user_id]; | |
NSData *requestData = [dataString dataUsingEncoding:NSUTF8StringEncoding]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func sendData() | |
{ | |
let old_price = Price.text! | |
UserDefaults.standard.setValue(old_price, forKey: "old_price") | |
let prs = [ | |
"coupon_code": CoupanField.text! as String , | |
"order_price" : "\(final_price)" | |
] as [String:String] | |
Service.Start(VC: self,dic: prs, url: "\(GlobalVariable.serverName)coupon.php", onCompletion: { result in | |
print("result \(result)") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void showToast(string text) | |
{ | |
if (Application.platform == RuntimePlatform.Android) { | |
AndroidJavaClass unityPlayer = new AndroidJavaClass ("com.unity3d.player.UnityPlayer"); | |
AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject> ("currentActivity"); | |
AndroidJavaClass Toast = new AndroidJavaClass ("android.widget.Toast"); | |
AndroidJavaObject javaString = new AndroidJavaObject ("java.lang.String", text); | |
AndroidJavaObject context = currentActivity.Call<AndroidJavaObject> ("getApplicationContext"); | |
AndroidJavaObject toast = Toast.CallStatic<AndroidJavaObject> ("makeText", context, javaString, Toast.GetStatic<int> ("LENGTH_SHORT")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//follow to following steps to get twitter login | |
step1- register your app on twitter dashboard | |
step 2- add following code in info.plist betbeen <dict> and </dict> | |
<key>CFBundleURLTypes</key> | |
<array> | |
<dict> | |
<key>CFBundleURLSchemes</key> | |
<array> | |
<string>twitterkit-<consumerKey></string> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#define USE_SharpZipLib | |
#if !UNITY_WEBPLAYER | |
#define USE_FileIO | |
#endif | |
/* * * * * | |
* A simple JSON Parser / builder | |
* ------------------------------ | |
* | |
* It mainly has been written as a simple JSON parser. It can build a JSON string |