동일한 코드는 iOS 5에서는 작동하지만 iOS 6에서는 작동하지 않습니다. 개수는 0으로 표시됩니다. 어떤 아이디어입니까? house.png이 유효한 이미지로 확인되었으므로 적어도 1을 카운트로 표시해야합니다.싱글 톤에서 nsmutable 배열에 객체를 추가 할 수 없습니다.
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
@interface MyManager : NSObject
{
MyManager *_sharedObject;
NSMutableArray * assets;
}
//Property Listing
@property(nonatomic,copy) NSString * postTitle;
@property(nonatomic,copy) NSString * postText;
@property(nonatomic,copy) NSString * postLink;
@property(nonatomic,copy) NSString * postCategory;
//assets
@property (nonatomic, strong) NSMutableArray * assets;
+ (id)sharedInstance;
- (void)reset;
@end
#import "MyManager.h"
@implementation MyManager
//Property Listing
@synthesize postTitle=_postTitle;
@synthesize postText=_postText;
@synthesize postLink=_postLink;
@synthesize postCategory=_postCategory;
@synthesize assets=_assets;
- (id)init
{
self = [super init];
if (self)
{
assets = [[NSMutableArray alloc] init];
NSLog(@"Singleton Initialized...");
}
return self;
}
+ (id)sharedInstance
{
static dispatch_once_t pred = 0;
__strong static id _sharedObject = nil;
dispatch_once(&pred, ^{
_sharedObject = [[self alloc] init]; // or some other init method
});
return _sharedObject;
}
- (void)reset
{
self.postTitle [email protected]"";
[email protected]"";
[email protected]"";
[email protected]"";
[self.assets removeAllObjects];
}
@end
이상한 일입니다. house.png이 대상에없는 것일 수 있습니까? 이미지가 '복사 번들 리소스'단계에 있는지 확인 하시겠습니까? – Vinzzz