質問編集履歴
1
コードの余白などを削除
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
以下のAPIを試しているのですが、"invalid authentication"と言うエラーが出てしまい、どうしてもうまくいきません。
|
2
|
+
|
3
|
+
|
2
4
|
|
3
5
|
https://coincheck.com/ja/documents/exchange/api#auth
|
4
6
|
|
@@ -8,35 +10,29 @@
|
|
8
10
|
|
9
11
|
|
10
12
|
|
11
|
-
// コインチェック
|
12
|
-
|
13
|
-
- (void)httpRequest
|
13
|
+
- (void)httpRequest:(NSString*)actionType priceString:(NSString*)priceString
|
14
14
|
|
15
15
|
{
|
16
16
|
|
17
17
|
NSInteger unixtime = [[NSDate date] timeIntervalSince1970];
|
18
18
|
|
19
|
-
|
20
|
-
|
21
19
|
NSURLComponents *components = [NSURLComponents componentsWithString:@"https://coincheck.com/api/exchange/orders"];
|
22
20
|
|
23
|
-
NSURLQueryItem *pair
|
21
|
+
NSURLQueryItem *pair = [NSURLQueryItem queryItemWithName:@"pair" value:@"btc_jpy"];
|
24
22
|
|
25
|
-
NSURLQueryItem *order_type
|
23
|
+
NSURLQueryItem *order_type = [NSURLQueryItem queryItemWithName:@"order_type" value:actionType];
|
26
24
|
|
27
|
-
NSURLQueryItem *currency_pair
|
25
|
+
NSURLQueryItem *currency_pair = [NSURLQueryItem queryItemWithName:@"rate" value:priceString];
|
28
26
|
|
29
|
-
NSURLQueryItem *amount
|
27
|
+
NSURLQueryItem *amount = [NSURLQueryItem queryItemWithName:@"amount" value:BitCoinPrice];
|
30
28
|
|
31
29
|
components.queryItems = @[pair,order_type,currency_pair,amount];
|
32
30
|
|
33
31
|
|
34
32
|
|
35
|
-
|
36
|
-
|
37
33
|
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
|
38
34
|
|
39
|
-
|
35
|
+
|
40
36
|
|
41
37
|
NSString *url = @"https://coincheck.com/api/exchange/orders/";
|
42
38
|
|
@@ -45,8 +41,6 @@
|
|
45
41
|
|
46
42
|
|
47
43
|
[req setValue:@"xxxxxxxxxx" forHTTPHeaderField:@"ACCESS-KEY"];
|
48
|
-
|
49
|
-
|
50
44
|
|
51
45
|
NSString *unixTimes =[NSString stringWithFormat:@"%ld",(long)unixtime];
|
52
46
|
|
@@ -57,8 +51,6 @@
|
|
57
51
|
NSString *strx = [NSString stringWithFormat:@"%@%@%@", unixTimes, url, components.query];
|
58
52
|
|
59
53
|
[req setValue:[self hmac256:strx withKey:@"xxxxxxxxxxxxx"] forHTTPHeaderField:@"ACCESS-SIGNATURE"];
|
60
|
-
|
61
|
-
|
62
54
|
|
63
55
|
|
64
56
|
|