iOS Developer Center からダウンロードした SampleFTPSample ソース コード (iOS6.0 SDK、Xcode4.5) を実行します。 サンプルFTPSample
イメージとして、ftpServer からリストを取得すると、EXC_BAD_ACCESS エラーが発生することがあります。コードを変更していません。理由がわかりません。どうすれば修正できますか?
どうもありがとうございました。
iOS Developer Center からダウンロードした SampleFTPSample ソース コード (iOS6.0 SDK、Xcode4.5) を実行します。 サンプルFTPSample
イメージとして、ftpServer からリストを取得すると、EXC_BAD_ACCESS エラーが発生することがあります。コードを変更していません。理由がわかりません。どうすれば修正できますか?
どうもありがとうございました。
これを行うには、(CFReadStreamCreateWithFTPURL を使用して) ストリームを作成した直後に、kCFStreamPropertyFTPAttemptPersistentConnection プロパティを false に設定します。これは次のようになります。
success = [self.networkStream setProperty:(__bridge id) kCFBooleanFalse
forKey:(__bridge NSString *) kCFStreamPropertyFTPAttemptPersistentConnection
];
assert(success);
うん!! 私はついに解決策を得ました。メインスレッドが終了した後に uialertview show を呼び出したので、今はクラッシュしません。私の場合です。正確な答えはありませんが、このピーターローンを適用することもできます. あなたにも役立つかもしれません。!!
- (void)_startReceive:(NSString*) urlPath
{
BOOL success;
NSURL * url;
CFReadStreamRef ftpStream;
assert(self.networkStream == nil); // don't tap receive twice in a row!
// First get and check the URL.
if(urlPath != nil)
{
...url = FTP_URL here...
}
success = (url != nil);
// If the URL is bogus, let the user know. Otherwise kick off the connection.
if ( ! success)
{
[self _updateStatus:@"Invalid URL"];
}
else
{
// Create the mutable data into which we will receive the listing.
self.listData = [NSMutableData data];
assert(self.listData != nil);
// Open a CFFTPStream for the URL.
ftpStream = CFReadStreamCreateWithFTPURL(NULL, (__bridge CFURLRef) url);
assert(ftpStream != NULL);
self.networkStream = (__bridge NSInputStream *) ftpStream;
success = [self.networkStream setProperty:(__bridge id) kCFBooleanFalse
forKey:(__bridge NSString *) kCFStreamPropertyFTPAttemptPersistentConnection
];
assert(success);
self.networkStream.delegate = self;
[self.networkStream scheduleInRunLoop:[NSRunLoop currentRunLoop]forMode:NSDefaultRunLoopMode];
[self.networkStream open];
// Have to release ftpStream to balance out the create. self.networkStream
// has retained this for our persistent use.
CFRelease(ftpStream);
// Tell the UI we're receiving.
[self _receiveDidStart];
}
}