问题标签 [nsoperation]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
datagridview - 数据适配器无法更新在 .NET 中添加/更新/删除的记录
脚步,
- 具有单一表单的 Crate 窗口应用程序
- 从数据添加新数据源->添加新数据源
- 转到数据-> 显示数据源
- 删除任何表格以形成。此步骤将添加两个控件。一个。数据网格视图 B. 绑定导航器
按 F5 运行。
我可以查看所有记录,但无法添加/更新/删除。
下面是 VS 生成的表单代码。
iphone - 新手问题: NSOperation for iphone SDK
嗨,我遇到了 NSOperation 的一些问题。我总是在self = [super init];
(已经使用断点找到它)出错它总是返回“程序接收信号:EXC_BAD_ACCESS”
对于.m
好吧,我坚持了一段时间,如果可能的话,有任何资源,文章内容是 NSoperation 的基本示例吗?
iphone - Iphone——对我的 NSOperation 中的泄漏感到困惑
我的应用程序有一个名为 ServerRequest 的 NSOperation 类来处理网络任务。根据仪器,它正在疯狂地泄漏。此外,instruments 表示构建请求的代码正在泄漏,即使这不是 NSOperation。但是我在设置自动释放池方面遵循了 Apple 的建议,所以我不明白这可能是什么问题。任何人都可以帮忙吗?
我的部分代码如下:
和 postResult 方法(没有泄漏):
最后,dealloc:
iphone - NSOperation, Synchronous NSURLConnection, & UIWebView on iPhone
I have a weird issue. Here is the setup:
- I have a NSOperationQueue which I add NSOperation subclass objects to. These do networking using NSURLConnection sendSynchronousRequest method. As I understand it, these are completely asynchronous, since they are NSOperations which each get their own thread.
- If I launch my app WITHOUT any background networking operations, loading a URL into a UIWebView works just fine.
If I launch my app, and run some background networking operations, loading a URL into a UIWebView results in this error:
Error Domain=WebKitErrorDomain Code=102 UserInfo=0x1996d60 "Frame load interrupted"
and any subesequent attempts to load a UIWebView fails with the same error.
Is there some weird interaction between UIWebView and NSURLConnection that I need to be aware of? My next step is to replace the synchronous calls with a fully async NSOperation, but it is such a weird bug that I figured I would ask the experts.
I have isolated the error down to the NSURLConnection sendSynchronousRequest method. If I call this from an NSOperation, UIWebView breaks horribly.
The 102 error has to do with some "Policy Changed" error in WebKit, which is poorly/non-documented anywhere.
Anybody have any idea? Any help is greatly appreciated!
EDIT: Looks like this is a cookie issue of some kind. Any reason why UIWebView would fail to load if the web server is setting a cookie via a background HTTP Request?
iphone - NSOperation 和 fwrite (Iphone)
我对这段代码有问题。基本上我想从定时器函数异步执行 fwrite。
这是我的 Timer 函数中的代码块。(这将由计时器每 0.2 秒调用一次。
WrtiteFilerOperation 是一个 NSoperation 类,它必须将传递的缓冲区写入文件。我在 WriteFileOperation 的“start”方法中添加了这段代码。
这里的问题是,我的 timerFunction 被 NSOperation 阻塞,直到它将缓冲区写入文件。(我的意思是阻塞直到 start 方法完成其执行)并且性能似乎与直接将 fwrite 放入 timerFunction 相同。
我只想返回 timerFunction 而无需等待 start 方法执行完成。
我在这里做错了什么?
提前致谢
拉古
objective-c - 在 insertNewObjectForEntityForName:inManagedObjectContext 上的 exc_bad_access
我写了一个我遇到的问题的最小代码示例。我以两种方式实现后台工作:手动生成线程和让NSOperation
处理线程。在这两种情况下,我都在NSManagedObjectContexts
为每个线程/操作创建。
当我自己生成线程时,performSelectorInBackground:withObject:
一切正常。当我切换到将我的对象传递给 an时,NSOperationQueue
我在尝试保存操作时看到以下错误NSManagedObjectContext
。
-EXC_BAD_ACCESS - 严重的应用程序错误。在核心数据更改处理期间捕获到异常:*** -[NSCFSet addObject:]:尝试使用 userInfo (null) 插入 nil - _referenceData64 仅为抽象类定义。定义 -[NSTemporaryObjectID_default _referenceData64]!
我相信这个错误,特别是考虑到最后一个错误,与使用临时 objectID 在线程/上下文之间传递对象有关。可能,更糟糕的是,我不知何故NSManagedObjects
在线程之间传递。
无论哪种方式,我都找不到任何建议我这样做的代码。
我的最小代码示例可以在这里找到。
大部分工作都是在 in 中完成AppDelegate
的awakeFromNib
。设置EXECUTE_WITH_NSOPERATION
为 0 以运行performSelectorInBackground:withObject:
. 保留EXECUTE_WITH_NSOPERATION
1 以执行NSOperationQueue
创建一堆MCBoardParse
对象。
我只在 10.6 下看到这个。
原来的
我有一个基于 10.5 框架的 Cocoa 应用程序。在NSOperation
一个循环中,我正在快速创建数百个NSManagedObjects
. 经常创建这些NSManagedObejcts
会因 EXC_BAD_ACCESS 错误而崩溃。这发生在引用计数内存管理和垃圾收集下。
Thumbnail 和 Image 都是NSManagedObject
用 mogenerator 生成的子类。 insertInManagedObjectContext:
好像
moc 被定义为(nonatomic, retain)
并合成。据我所知,持久存储和我的存储appDelegate
没有理由被垃圾收集,也没有被垃圾收集。
堆栈跟踪看起来像
我的应用程序在其他地方因 EXC_BAD_ACCESS 而崩溃,但这是最常发生的代码。所有堆栈跟踪看起来都相似,并且与CFHash
.
iphone - 视图更改时从队列中删除 NSOperation
我正在创建一个涉及如此多的 Web 服务调用的应用程序。我正在使用 NSOperation 来执行 Web 服务调用。应用程序中有几个视图,每次加载视图时我都会调用 Web 服务。由于是导航,如果用户在操作完成之前决定返回上一个视图,另一个操作将进入队列并等待上一个操作完成。当视图发生变化时,有什么方法可以阻止之前的操作被执行?请帮忙
objective-c - 当 MaxConcurrentOperationCount > 1 时,我得到 EXC_BAD_ACCESS
您好,我正在使用 NSOperationQueue 在后台下载图像。我创建了一个自定义 NSOperation 来下载图像。我将图像放在表格单元格中。问题是如果我执行 [operationQueue setMaxConcurrentOperationCount: 10] 并向下滚动几个单元格,程序会因 EXC_BAD_ACCESS 而崩溃。每次它在桌子的同一个地方崩溃。一个接一个地有 3 个单元,它们是同一家公司的,并且具有相同的徽标,因此基本上它应该下载图像 3 次。每隔一段时间它工作正常。
这就是我处理下载图像的方式。如果我在上面的函数中注释掉
[delegate didFinishDownloadingImage: self];
它不会崩溃,但它当然没用。
objective-c - 多个 NSOperationQueues?
我想NSOperations
在我的应用程序中使用来解决线程问题。我已经阅读了一些教程,现在我知道我必须做什么,但是我有一个问题。NSOperationQueue
每个班级都必须有相同的内容。如果我NSOperationQueue
在每个班级都使用新的怎么办。会不会有并发问题?
objective-c - NS操作和键值观察
我正在创建一个 MyOperation 对象(继承自 NSOperation)并添加到 NSOperationQueue。然后我在 MyOperation 上做 KVO。我正在使用这种方法
如果完成,则从 MyOperation 获取值。在这种方法中,我使用来自其他类的便捷方法来获取其他数据。
也许在 observeValue... 方法中存在同步问题?