在Objective-C中获取HTTP目录列表(Get HTTP Directory Listing In Objective-C)
我在Objective-C中制作一个Mac应用程序,我想通过HTTP在我的网站空间的目录中显示一个文件列表(除非建议使用替代方法)。
然后,从该列表中,用户可以单击按钮并下载所选文件。
我的问题是,你会如何推荐我接近这个? 我之前,下载或任何事情都没有使用Objective-C深入研究HTTP,所以如果你能指出我正确的方向,那就太好了。
希望你能帮忙,谢谢。
I am making a Mac application in Objective-C and I want to show a list of files from a directory on my webspace via HTTP (unless an alternative method is recommended).
Then from this list the user can click a button and download the chosen file.
My question is, how would you recommend i approach this? I haven't delved into HTTP with Objective-C before, downloading or anything, so if you can point me in the right direction it would be great.
Hope you can help, thanks.
原文:https://stackoverflow.com/questions/7391630
最满意答案
我想,你不应该使用推送通知的onMessage方法中的AsyncTask。 您应该调用一个执行http连接任务的服务。 如果您使用的是Service类,请记住使用单独的线程,因为它仅在UI线程上运行。 我希望这能够帮到你。
I guess, you should not use AsyncTask from the onMessage method of Push Notification. You should call a service which does the task of making http connection. Also remember to use separate thread if you are using Service class as it runs on UI thread only. I hope this helps you out.
相关问答
更多-
等待postMessage被react-native实现覆盖。 否则,您正在使用默认的postMessage实现。 RN做的是用它自己的postMessage替换window.postMessage ,它只接受一个参数。 看这里: const SCRIPT = ` function init() { postMessage('LOADED:'); } function whenRNPostMessageReady(cb) { if (postMessa ...
-
Backendless问题,如何防止推送通知显示(Backendless issue, how to prevent push notification from showing)[2021-12-24]
请按照GitHub上的文档进行操作: https : //github.com/Backendless/Android-SDK/blob/master/docs/push.md 为了完成不显示推送通知,您需要执行以下操作: 覆盖BackendlessPushService并从onMessage()方法返回false 覆盖BackendlessBroadcastReceiver并从getServiceClass()方法返回您的实现类 在AndroidManifest.xml声明您的重写接收器 所有这些步骤都通 ... -
有可能,请参阅用于处理解析通知有效负载的解析文档: https : //parse.com/docs/ios/guide#push-notifications-responding-to-the-payload 请记住,如果应用程序在您收到通知时正在运行,则必须以与应用程序关闭时不同的方式处理它。 在这两种情况下,您都可以通过app delegate处理有效负载以打开聊天视图控制器。 您可以重新加载该视图控制器的viewdidload()中的聊天窗口。 It's possible, see the pars ...
-
DatagramPacket receive()操作是阻塞的,所以你通常会做的就是启动一个单独的线程,它将在循环中侦听传入的数据报并将它们分派进行进一步处理,如下所示: void run() { socket = new DatagramSocket(4445); while(true) { byte[] buf = new byte[256]; DatagramPacket packet = new DatagramPacket(buf, buf.le ...
-
看起来我已经有了它的工作。 (主要是。如果应用程序未运行且用户刷掉通知,或直接从启动器打开应用程序,则通知仍未显示在应用程序中。) 有两件事需要做: WL.Client.Push.onMessage的赋值必须在“任何函数之外”完成 看起来像native/res/values/strings.xml字符串“app_name”的native/res/values/strings.xml用于从推送服务中找到应用程序并确保消息通过 第二点对我来说仍然没有意义,但看起来AndroidManifest.xml的inte ...
-
答案其实很简单。 @PushEndpoint的onMessage()函数必须返回一些东西。 在我的情况下,改变它 public void onMessage() { } 至 public boolean onMessage() { return true; } 解决了我的问题。 如果方法没有返回任何内容,套接字将无法识别它。 The answer is actually quite simple. The onMessage() fun ...
-
这可以通过在Android中实现BroadcastReceiver来完成 当您的接收方通知检查案例 案例1:如果聊天屏幕打开,请调用BroadcastReceiver在后台更新数据库聊天 案例2:如果聊天屏幕未打开则显示通知 this can be done by implementing BroadcastReceiver in Android when your receiver notification check case case 1 : if chat screen is open call B ...
-
在onMessage()上获取推送通知时执行一些代码(Executing some code when a push notification is recived on onMessage())[2023-03-20]
我想,你不应该使用推送通知的onMessage方法中的AsyncTask。 您应该调用一个执行http连接任务的服务。 如果您使用的是Service类,请记住使用单独的线程,因为它仅在UI线程上运行。 我希望这能够帮到你。 I guess, you should not use AsyncTask from the onMessage method of Push Notification. You should call a service which does the task of making ht ... -
Ionic Cordova:推送通知插件onMessage接收消息。(Ionic Cordova : Push Notification plugin onMessage receive message.)[2021-09-24]
我建议你修改推送通知插件代码。 每当您收到通知时,在GCMIntentService.java中都会检查app是否在前台或后台。 如果app不在前台,则使用以下语法将通知有效内容数据保存在SharedPreferences中 SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putStri ... -
每当收到推送通知时,都会在mainActivity中执行某些操作(do something inside mainActivity whenever a push notification is received)[2022-06-15]
我不喜欢保持对活动的静态引用。 我认为它们是一群可以在你身上爆发的蠕虫。 因此,您将建议替代@TeRRo答案: 在您的全局BroadcastReceiver onMessage您将发送您的活动将要收听的LocalBroadcast 。 像这样: private static final String ACTION_PUSH_RECEIVED = "com.myapp.mypackage.action.pushReceived"; public static final IntentFilter BROADC ...