更新 0
toとdeals
to_deals
を全部変えて次のメソッドを追加してメソッドの最後に呼び出すということですか?もしそうなら、電話はどのように見えますか?iboards
_iboards
processPbn
- (id)initWithName:(NSInteger )_iboard deals:(NSArray *)_deals
{
self = [super init];
if (self) {
iboard = _iboard;
deals = _deals;
return self;
}
return nil;
}
更新 0
で計算される2 つの変数deals
とをで使用できるようにしたいと考えています。BSViewController.mの最後 (最後の 3 行)のコードで、次の 2 つのセマンティックな問題が発生しています。iboards
BSViewcontroller
BSdealViewController
"Local declaration of 'deals' hides instance variable"
"Local declaration of 'iboards' hides instance variable"
BSViewController.h
#import <UIKit/UIKit.h>
@interface BSViewController : UIViewController <....>
{
NSInteger iboard;
NSArray *deals;
}
@property (nonatomic) NSInteger iboard;
@property (nonatomic, strong) NSArray *deals;
- (void) processPbn;
@end
BSViewController.m
#import "BSViewController.h"
@interface BSViewController ()
@end
@implementation BSViewController
@synthesize iboard, deals;
- (void) processPbn
{
NSURLRequest *theRequest = [NSURLRequest .....];
[NSURLConnection sendAsynchronousRequest:theRequest queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *connection, NSData *data, NSError *error)
{
NSString *string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSString *sp = @" ";
NSArray*deals=@[[@[sp, sp, sp, sp]mutableCopy],[@[sp, sp, sp, sp]mutableCopy],[@[sp, sp, sp, sp]mutableCopy],[@[sp, sp, sp, sp]mutableCopy],[@[sp, sp, sp, sp]mutableCopy],[@[sp, sp, sp, sp]mutableCopy]];
NSString *toMatch = @"...";
int iboard = 0;
NSRegularExpression *regex = [....];
NSUInteger numberOfMatches = [....];
for (NSTextCheckingResult* board in [.....])
{
for (NSUInteger irange = 1; irange < board.numberOfRanges; ++irange)
{
NSRange matchedRange = [board rangeAtIndex: irange];
NSString* tstring = [string substringWithRange: matchedRange];
for (NSUInteger ix = 0; ix < tstring.length; ++ix)
{
NSRange cardInSuit = NSMakeRange(ix, 1);
int seat = (irange-1)/4 ;
int suit = (irange-1)%4 ;
NSString* replace= [deals[iboard][suit] ....];
[deals[iboard] replaceObjectAtIndex: suit withObject: replace];
}
}
++iboard;
}
}];
}
@end
(上記の結果ですか?)Use of undeclared identifier 'iboard'
以下の NSLog 命令でもエラーが発生します。
BSdealViewController.m
#import "BSdealViewController.h"
#import "BSViewController.h"
@interface BSdealViewController ()
@end
- (void)viewDidLoad
{
NSLog(@"iboard : %@", iboard);
}