我正在使用Erica Sadun的异步下载方法(此处链接到项目文件:下载),但是她的方法不适用于具有大尺寸(50 mb或更高)的文件.如果我尝试下载超过50 MB的文件,它通常会因内存崩溃而崩溃.无论如何我可以调整这段代码,以便它也适用于大文件?这是我在DownloadHelper类中的代码(已经在下载链接中):
.H
@protocol DownloadHelperDelegate <NSObject>
@optional
- (void) didReceiveData: (NSData *) theData;
- (void) didReceiveFilename: (NSString *) aName;
- (void) dataDownloadFailed: (NSString *) reason;
- (void) dataDownloadAtPercent: (NSNumber *) aPercent;
@end
@interface DownloadHelper : NSObject
{
NSURLResponse *response;
NSMutableData *data;
NSString *urlString;
NSURLConnection *urlconnection;
id <DownloadHelperDelegate> delegate;
BOOL isDownloading;
}
@property (retain) NSURLResponse *response;
@property (retain) NSURLConnection *urlconnection;
@property (retain) NSMutableData *data;
@property (retain) NSString *urlString;
@property (retain) id delegate;
@property (assign) BOOL isDownloading;
+ …Run Code Online (Sandbox Code Playgroud) 我想知道如何获取textLabel所选的字符串值uitableviewcell.
我有一个非常快速的问题.我的程序实际上下载了一个zip文件,然后将其提取到桌面上.但我需要一个卸载功能,它基本上删除多个文件夹和包含文件.我怎么能在vb.net中这样做?
我正在使用vb.net,并且在我的程序中,当我运行我的后台工作程序时,我会得到这个'crossthread操作无效'错误,这将使此文本框启用为true.我的主要sub将首先将enabled设置为false,当backgroundworker运行时,它将返回true,然后退出.为什么它会给我一个错误?仅供参考:有更多的代码,但我不想让它更令人困惑......
这是堆栈跟踪:
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.OnEnabledChanged(EventArgs e)
at System.Windows.Forms.Control.set_Enabled(Boolean value)
at Helium.Form1.BackgroundWorker1_DoWork(Object sender, DoWorkEventArgs e) in C:\Users\Kevin\documents\visual studio 2010\Projects\Helium\Helium\Form1.vb:line 167
at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
Run Code Online (Sandbox Code Playgroud)
这是确切的错误消息:
{"Cross-thread operation not valid: Control 'mainText' accessed from a thread other than the thread it was created on."}
Run Code Online (Sandbox Code Playgroud)
有人可以帮帮我!
谢谢,
凯文
有谁知道如何包装文本UITextField?我在Xcode中使用Cocoa/Objective-C作为我的iPhone项目,我似乎找不到办法做到这一点......
有没有办法将.NET应用程序转换为Mac OS X应用程序?我正在使用Visual Basic 2008,我希望Mac用户也可以使用我的应用程序.可能吗?如果是这样,请回复链接或来源.
我需要在我的应用程序中使用UIPagecontrol,我不知道如何开始.我是初学者,苹果给我的例子非常复杂.我只需要3页,每页都有不同的视图.
我是开发基于视图的iPhone应用程序的新手,我需要从互联网上下载这个"txt"文件并将其保存到应用程序的文档文件夹中.谁能告诉我我怎么做到这一点?txt文件很小,所以我不需要任何用户界面对象......
谢谢,
凯文
如果整数是正数还是负数,我如何在objective-c编码中说明.我正在这样做,以便我可以写一个"if"语句,声明如果这个整数是正数,那么这样做,如果它的负数做这个.
谢谢,
凯文
iphone ×4
objective-c ×4
cocoa-touch ×3
download ×2
vb.net ×2
xcode ×2
.net ×1
cocoa ×1
delete-file ×1
directory ×1
large-files ×1
macos ×1
nsinteger ×1
nstimer ×1
uikit ×1
uitableview ×1
uitextfield ×1
word-wrap ×1