Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/110.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 无法使用OBJ-C中的cURL获取返回数据_Ios_Objective C_Curl - Fatal编程技术网

Ios 无法使用OBJ-C中的cURL获取返回数据

Ios 无法使用OBJ-C中的cURL获取返回数据,ios,objective-c,curl,Ios,Objective C,Curl,因此,我试图使我的iOS调整命令!所以我想我应该使用cURL!它将使用GET方法 例如,如果我编写命令“$ud test”并单击enter,它将从网站()返回数据,并在我单击send/enter后用数据替换“$ud test”。我写了一些东西,但我知道它错了。我似乎找不到任何我能在网上理解的教程!我应该说我是个初学者!谢谢大家! %hook CoreDataConversationManager - (void) sendTextMessage:(id)command withRend

因此,我试图使我的iOS调整命令!所以我想我应该使用cURL!它将使用GET方法

例如,如果我编写命令“$ud test”并单击enter,它将从网站()返回数据,并在我单击send/enter后用数据替换“$ud test”。我写了一些东西,但我知道它错了。我似乎找不到任何我能在网上理解的教程!我应该说我是个初学者!谢谢大家!

    %hook CoreDataConversationManager

- (void) sendTextMessage:(id)command withRenderInstructionSet:(id)arg1 toConversation:(id)arg2 isSuggestedResponse:(BOOL)arg3
{
   NSString *url = @"https://K8.reko.io/v1/api.php?ud=";
   NSMutableString *userInput = NSMutableString.alloc.init;
   [url appendString:(@"%@", userInput )];

   if ([command hasPrefix:@"$ud"]) command = userInput;
   return %orig;
}
   %end
与此相反:

NSString*url=@; NSMutableString*userInput=NSMutableString.alloc.init; [url appendString:(@“%@”,userInput)]

你想要的是:

NSString *userInput        = @"userInput";

NSString *urlStringPartial = @"https://K8.reko.io/v1/api.php?ud=";
NSString *urlStringFull    = [urlStringPartial stringByAppendingPathComponent:userInput];

NSLog(@"urlStringFull: %@", urlStringFull);
urlStringFull:https:/K8.reko.io/v1/api.php?ud=/userInput


哇,我以前从未见过有人使用过
NSMutableString.alloc.init
:我有人帮我,但他走了,这行不通;(学习和学习,这就是我们所做的。