小编Mus*_*afa的帖子

如何使用NSManagedObjectSubClass从CoreData Base获取所有记录?

我正在尝试CoreDataiosApplication中实现,现在我想从Entity获取所有记录MUSTHAFA

  My  NSManagedObjectedSubClass is MUSTAHFA
Run Code Online (Sandbox Code Playgroud)

MUSTHAFA.m

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>

@interface MUSTHAFA : NSManagedObject {
@private
}
@property (nonatomic, retain) NSString * FirstName;
@property (nonatomic, retain) NSNumber * Age;
@property (nonatomic, retain) NSString * Location;
@property (nonatomic, retain) NSString * LastName;

@end

#import "MUSTHAFA.h"


@implementation MUSTHAFA
@dynamic FirstName;
@dynamic Age;
@dynamic Location;
@dynamic LastName;

@end
Run Code Online (Sandbox Code Playgroud)

将记录添加到核心数据

-(void)AddRecordToCoreData{

    //NSLog(@"______ ADD Core Data Implementaion");  
    MUSTHAFA *event = (MUSTHAFA *)[NSEntityDescription insertNewObjectForEntityForName:@"MUSTHAFA" inManagedObjectContext:managedObjectContext];
    [event setLastName:@"JOHN"];
    [event setFirstName:@"JOSE "];
    [event …
Run Code Online (Sandbox Code Playgroud)

core-data objective-c nsmanagedobject nsmanagedobjectcontext ios

13
推荐指数
2
解决办法
3万
查看次数

performSelector可能导致泄漏,因为其选择器未知IN Singleton Class/FUNCTION Pointer -Passing Function作为参数

@interface URLClass : NSObject
{
    id target;
    SEL funObj;
}
+ (URLClass *)sharedInstance;
-(void)theBigFunction:(SEL)func :(id)target;
@property (nonatomic,retain) SEL funObj;

#import "URLClass.h"

static URLClass *instance = NULL;


@implementation URLClass
{
    NSMutableData *webData;
}
- (id)init
{
    if ( self = [super init] )
    {

    }
    return self;    
}

+ (URLClass *)sharedInstance
{
    @synchronized([URLClass class])
    {
        if (!instance)
            instance = [[super alloc] init];        
        return instance;
    }    
    return nil;
}
-(void)theBigFunction:(SEL)func :(id)targetObj{

    funObj =func;
    target=targetObj;  
    NSURL *URL = [NSURL URLWithString:@"urlString"];    
    NSURLRequest *request = …
Run Code Online (Sandbox Code Playgroud)

delegates objective-c ios

10
推荐指数
4
解决办法
1万
查看次数

Apple的Web服务操作不成功且无法对包进行身份验证?

当我尝试使用Application Loader上传应用程序时,我收到以下错误:

  1. Apple的Web服务操作并不成功.
  2. 无法验证包787376632.itmsp
  3. ERROR ITMS-9000:"无效的图像路径_在软件/ SoftwareAsset(MZItemspSoftwareAssetPackage)下的密钥'CGBundleIcons':'iTunesArtwork'下引用的路径中找不到图像
  4. ERROR ITMS-9000:"无效的图像路径_在软件/ SoftwareAsset(MZItemspSoftwareAssetPackage)上的密钥'CGBundleIcons':'iTunesArtwork @ 2x'下引用的路径中找不到图像

请任何人帮助我

在此输入图像描述

iphone app-store itunesartwork ios

8
推荐指数
1
解决办法
5259
查看次数

OCUnit已被弃用.将Xcode升级到5.1后出现错误

我刚刚更新到Xcode 4.6到5.1和iOS 7.0到7.1.1现在我的项目显示警告警报视图"OCUnit已弃用项目"项目名称"使用OCUnit进行单元测试,不推荐使用.选择"转换为XCTest"以更新此项目以使用XCTest进行单元测试."

在此输入图像描述

当我提交到应用商店时,它会影响我的应用吗?

如何删除此警告(或)如何更新我的应用程序以使用XCTest进行单元测试.

xcode unit-testing ios xctest ios7.1

7
推荐指数
1
解决办法
3075
查看次数

如何将CGContextAddArc(CGContextRef)中的所有点存储到NSMUtableArray

我怎样才能将CGContextAddArc中的所有像素点到NSMutableArray.or CGContextRef到NSMutable Array

static inline float radians(double degrees) 
{
 return degrees * PI / 180;
}

- (void)drawRect:(CGRect)rect
{
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGRect parentViewBounds = self.bounds;
    CGFloat x = CGRectGetWidth(parentViewBounds)/2;
    CGFloat y = CGRectGetHeight(parentViewBounds)/2;
    UIColor *rbg=[UIColor redColor];
    CGContextSetFillColor(context, CGColorGetComponents( [rbg CGColor]));
    CGContextMoveToPoint(context, x, y); 
    CGContextAddArc(context, x, y,100,radians(35),radians(105),0); 
        CGContextClosePath(context); 
        CGContextFillPath(context);
// here I want to store All points Containing in the Arc to NSMutableArray


 NSMutableArray *pointsArray=????
        }
Run Code Online (Sandbox Code Playgroud)

图片在此输入图像描述

iphone quartz-graphics nsmutablearray drawrect cgcontextref

6
推荐指数
1
解决办法
1066
查看次数

选择UITeViewView上的UITextView失去调用didSelectRowAtIndexPath委托方法的能力?

我有我的问题UITableViewCellselection.I正在使用 UITableViewCell一个UITextView子视图.在UITextView启用用户交互的情况下,该对象不可编辑,不可滚动.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    static NSString *CellIdentifier = @"Cell";    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {      
        cell=[[[NSBundle mainBundle]loadNibNamed:@"DemoCell" owner:self options:nil]objectAtIndex:0];         
        cell. accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    }
      if([distanceArray count]){ 
        UILabel *label1=(UILabel*)[cell viewWithTag:1];      
        label1.text=[locationNameArray objectAtIndex:[indexPath section]];
        label1.textColor=[UIColor blueColor];
        UILabel *label2=(UILabel*)[cell viewWithTag:2];        
        [label2 setText:[distanceArray objectAtIndex:[indexPath section]]];
        UITextView *tview=(UITextView*)[cell viewWithTag:3];   
        [tview setText:[discriptionArray objectAtIndex:[indexPath section]]];         
        return cell;
      }
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    DetailedLocationVIew *dView=[[DetailedLocationVIew alloc]initWithNibName:@"DetailedLocationVIew" bundle:nil];       
    [self.navigationController pushViewController:dView animated:YES];
    [dView …
Run Code Online (Sandbox Code Playgroud)

iphone uitableview uitextview ios

5
推荐指数
2
解决办法
7749
查看次数

如何将sizeWithFont转换为sizeWithAttributes(iOS 7)

如何在iOS 7 SDK中获得CGSize价值NSString,只想转换下面的代码行sizeWithAttributes.

CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:FONT_SIZE] constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping];
Run Code Online (Sandbox Code Playgroud)

objective-c nsstring cgsize ios7

5
推荐指数
1
解决办法
6858
查看次数

managedObjectContext deleteObject:匹配不从Core数据库中删除数据?

我试图从ios应用程序中的核心数据库中删除行但它不起作用,

if (editingStyle == UITableViewCellEditingStyleDelete) {

     appDelegate = [[UIApplication sharedApplication] delegate];   
        NSEntityDescription *entityDesc = [NSEntityDescription entityForName:@"PRODUCTTABLE" inManagedObjectContext:appDelegate.managedObjectContext];        
        NSFetchRequest *request = [[NSFetchRequest alloc] init];        
        [request setEntity:entityDesc];        
        NSError *error; 
        NSManagedObject *matches = nil;
        NSArray *objects = [appDelegate.managedObjectContext executeFetchRequest:request error:&error];
        NSLog(@"Array Count....%d",[objects count]);
        matches=[objects objectAtIndex:([indexPath row])];
        NSLog(@"...%@",[matches valueForKey:@"productID"]);
        NSLog(@"...%@",[matches valueForKey:@"pName"]);
        NSLog(@"...%@",[matches valueForKey:@"pPrice"]);
        NSLog(@"...%@",[matches valueForKey:@"pDate"]);           
        [appDelegate.managedObjectContext deleteObject:matches];


    }   
Run Code Online (Sandbox Code Playgroud)

以下代码的o/p:

Array Count....12
...ABC1226
...ABC-005
...599.39
...2012-08-09 05:07:50 +0000
Run Code Online (Sandbox Code Playgroud)

我从相同的NSManagedObject获取核心数据的数据.为什么删除不更新核心数据?

iphone core-data nsmanagedobjectcontext ios

4
推荐指数
1
解决办法
4781
查看次数

如何在iOS应用程序上实现Apple推送通知服务?

有没有说明如何整合所有样本项目APNSIPhone,以及如何获得deviceToken?

xcode push-notification apple-push-notifications ios

3
推荐指数
1
解决办法
1万
查看次数