小编Dar*_*zur的帖子

Android - 在GreenDao数据库中添加默认值

我想问一下,如果我在创建greenDao数据库时有可能添加默认值?

Example:
Property pictureIdProperty = user.addLongProperty("pictureId").getProperty();
Property thumbnailIdProperty = user.addLongProperty("thumbnailId").getProperty();
//and here I need something like this:
//thumbnailIdProperty.setDefault(-1); //there is possible to add 
user.addToOne(picture, pictureIdProperty);
user.addToOne(picture, thumbnailIdProperty, "thumbnail");
Run Code Online (Sandbox Code Playgroud)

当我使用数据库和这个表时,我不需要在创建此模型时始终添加默认值.

android greendao

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

UIImage 中的 iOS 内存泄漏

我正在使用 ios 7,我需要做:

在单独的线程中,我想从网络创建图像并将其放入 UIImageView。我需要每 200 毫秒执行一次。

我的代码看起来像:

- (void)startPreview:(CGFloat)specialFramesRates;
{
    if(isPreview)
        return;

    [Utils runOnThread:^{
        [Log log:@"Start preview"];   //here we have a leak

        isPreview = YES;
        while(isPreview) {
            [self getNewBitmap];

            sleep(fpsTime);

            if(!isPreview)
                break;

            if(checkAvabilityCam > 10)
                break;
        }

        [Log log:@"Stoped preview"];
    }];
}

- (void)getNewBitmap
{   
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
    [request setTimeoutInterval:1];
    [request setHTTPMethod:@"GET"];

    NSError *requestError;
    NSURLResponse *urlResponse = nil;


    NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&requestError];
    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
    if(delegate && response) {
        checkAvabilityCam = 0; …
Run Code Online (Sandbox Code Playgroud)

memory-leaks uiimage

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

标签 统计

android ×1

greendao ×1

memory-leaks ×1

uiimage ×1