小编Mau*_*imo的帖子

什么是最快/最简单的方法来判断同一SQL表中的2条记录是否不同?

我希望能够比较同一SQL表中的2条记录,并判断它们是否不同.我不需要告诉它们有什么不同,只是它们是不同的.

另外,我只需要比较记录中的10列中的7列.即.)每条记录有10列,但我只关心其中的7列.

这可以通过SQL完成,还是应该在C#中获取记录并对它们进行哈希以查看它们是否是不同的值?

sql

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

iPhone Objective C - 错误:指向预期浮点值的指针值

我不明白为什么我会收到这个错误.这是相关的代码:

Photo.h

#import <CoreData/CoreData.h>

@class Person;

@interface Photo :  NSManagedObject  
{
}

@property (nonatomic, retain) NSData * imageData;
@property (nonatomic, retain) NSNumber * Latitude;
@property (nonatomic, retain) NSString * ImageName;
@property (nonatomic, retain) NSString * ImagePath;
@property (nonatomic, retain) NSNumber * Longitude;
@property (nonatomic, retain) Person * PhotoToPerson;

@end
Run Code Online (Sandbox Code Playgroud)

Photo.m

#import "Photo.h"

#import "Person.h"

@implementation Photo 

@dynamic imageData;
@dynamic Latitude;
@dynamic ImageName;
@dynamic ImagePath;
@dynamic Longitude;
@dynamic PhotoToPerson;

@end
Run Code Online (Sandbox Code Playgroud)

这是我创建的mapViewController.m类.如果我运行它,CLLocationDegrees CLLat和CLLong行:

                CLLocationDegrees CLLat = (CLLocationDegrees)photo.Latitude;    
                CLLocationDegrees CLLong = (CLLocationDegrees)photo.Longitude;
Run Code Online (Sandbox Code Playgroud)

给我错误:指向预期浮点值的指针值. …

iphone objective-c

0
推荐指数
1
解决办法
3527
查看次数

为什么NSMutableArray在这个循环中被销毁?

这是arrayOfPerformances被破坏了.

这是数组的.h:

    NSMutableArray * arrayOfPerformances;
}
@property (nonatomic, retain) NSMutableArray * arrayOfPerformances;
Run Code Online (Sandbox Code Playgroud)

和.m有循环:

[dataArray release];
[dataDictionary release];
dataArray = [[NSMutableArray alloc] init];
dataDictionary = [[NSMutableDictionary alloc] init];

NSDate * CurrentDate = start;
int i = 0;

NSMutableArray * arrayOfPerformancesForCurrentDate = [[NSMutableArray alloc] init];
while(YES)
{
    i = 0;
    if ([arrayOfPerformancesForCurrentDate count] > 0)
    {
        [arrayOfPerformancesForCurrentDate removeAllObjects];   
    }

    for (i; i < self.arrayOfPerformances.count; i++)
    {
        Performance * performanceItem = [[Performance alloc] init]; 
        performanceItem = [self.arrayOfPerformances objectAtIndex:i];

        NSString * sPerformanceDate = [performanceItem.sDate …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c nsmutablearray

0
推荐指数
1
解决办法
119
查看次数

在使用setValue时,CoreData为实体插入新对象时给出了错误:forKey:with int

这是代码:

ComicDB * newComic = (ComicDB *)[NSEntityDescription insertNewObjectForEntityForName:@"ComicDB" inManagedObjectContext:context];
            [newComic setValue:comic.iComicId forKey:@"ComicID"];
            [newComic setValue:comic.sImage forKey:@"Image"];
            [newComic setValue:comic.sName forKey:@"Name"];
            [newComic setValue:comic.sText forKey:@"Text"];
            [newComic setValue:comic.sComicURL forKey:@"URL"];
Run Code Online (Sandbox Code Playgroud)

这是我得到的警告setValue:comic.iComicId forKey@"ComicID".仅供参考 - 漫画是我自己的类,其中包含漫画细节.警告:传递'setValue:forKey:'的参数1使得整数指针没有强制转换

当我将代码行更改为:

[newComic setValue:[comic.iComicId intValue] forKey:@"ComicID"];
Run Code Online (Sandbox Code Playgroud)

我得到这些警告和错误:警告:无效的接收器类型'int'警告:传递'setValue:forKey:'的参数1使得整数指针没有强制转换

我究竟做错了什么?

iphone core-data objective-c ios

0
推荐指数
1
解决办法
918
查看次数

标签 统计

iphone ×3

objective-c ×3

core-data ×1

ios ×1

nsmutablearray ×1

sql ×1