小编Pet*_*sey的帖子

通过SQLite将核心数据与SQL或MySQL同步

我正在尝试使用核心数据内置的表管理来构建iPhone应用程序.我想与MSSQL或MySQL数据库同步数据.核心数据与SQLite兼容,所以我认为它可以作为桥梁.任何人都可以想到如何实现这一功能?

mysql sqlite iphone cocoa-touch core-data

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

返回关键文本字段? - iPhone SDK

我已经在网上搜索了很长时间,我无法让它工作.在我的文本字段中,当我点击它然后按完成或返回它不会消失.我已经完成了每个教程的所有步骤,但我仍然无法让它工作.我在固件3.1.2上,但无论如何这里是我的ViewController.m中的代码:

- (void)viewDidLoad {

    [super viewDidLoad];

    blah.delegate = self;
    blah.returnKeyType = UIReturnKeyDone;

}

- (BOOL)blahShouldReturn:(UITextField *)blah{

    [blah resignFirstResponder];
    return YES;
}
Run Code Online (Sandbox Code Playgroud)

viewcontroller.h:

@interface BlahViewController : UIViewController <UITextFieldDelegate> {
    IBOutlet UITextField *blah;

}
Run Code Online (Sandbox Code Playgroud)

这些只是从文件中删除.无论如何,有人可以帮助我吗?点击它时我无法摆脱键盘......

谢谢,

凯文

cocoa-touch objective-c

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

控制应用程序执行次数

有没有办法控制iPhone应用程序执行的次数.例如,我有一个名为widget的游戏,我只希望用户玩游戏(新实例)不超过20个.另外,如果可以,那么你怎么能阻止这个人删除然后下载app再次获得另外10场比赛?

iphone sdk cocoa-touch

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

如何将值从Cocoa传递给SQLite查询

首先请让我说我对客观的c开发很新.我正在为iphone编写一个供个人使用的小应用程序,但是在执行以下代码时遇到了一些问题:

NSString *sql = [[NSString alloc] initWithFormat:@"select color_r, color_g, color_b from Calendar where ROWID = %@", [calendarsID objectForKey:[arrayColors objectAtIndex:row]]];

sqlite3_stmt *selectstmt;

if(sqlite3_prepare_v2(database, sql, -1, &selectstmt, NULL) == SQLITE_OK)
Run Code Online (Sandbox Code Playgroud)

编译器告诉我,我从不兼容的指针类型传递sqlite3_prepare_v2的参数2.无论如何,程序会被编译并运行,但是当它必须执行我刚刚向您显示的代码时,它会产生错误.它表示查询中存在语法错误,语法错误仅在查询的最后部分.而不是:

从Calendar中选择color_,color_g,color_b,其中ROWID = 63(例如)

我在最后一个数字的位置得到了奇怪的字符(63).我想这是一个与字符串转换有关的问题.可以请任何人帮帮我吗?

非常感谢您的关注.阿莱西奥

sqlite cocoa objective-c nsstring

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

将填充更改为已绘制的NSBezierPath

我想改变我画的按钮的填充(我将NSButton子类化)

这是我已经得到的代码:

- (void)drawRect:(NSRect)dirtyRect {
// Drawing code here.
// Create the Gradient 
NSGradient *fillGradient = [[NSGradient alloc] initWithStartingColor:[NSColor lightGrayColor] endingColor:[NSColor darkGrayColor]];
// Create the path
aPath = [NSBezierPath bezierPath];

[aPath moveToPoint:NSMakePoint(10.0, 0.0)];
[aPath lineToPoint:NSMakePoint(85.0, 0.0)];
[aPath lineToPoint:NSMakePoint(85.0, 20.0)];
[aPath lineToPoint:NSMakePoint(10.0, 20.0)];
[aPath lineToPoint:NSMakePoint(0.0, 10.0)];
[aPath lineToPoint:NSMakePoint(10.0, 0.0)];

[fillGradient drawInBezierPath:aPath angle:90.0];
[fillGradient release];
}

- (void)mouseDown:(NSEvent *)theEvent {
    NSGradient *fillGradient = [[NSGradient alloc] initWithStartingColor:[NSColor lightGrayColor] endingColor:[NSColor darkGrayColor]];
    [fillGradient drawInBezierPath:aPath angle:-90.0];
}
Run Code Online (Sandbox Code Playgroud)

我收到一个EXC_BAD_ACCESS信号 我该怎么做?

cocoa drawing objective-c

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

为什么这个NSTask terminationStatus返回一个nil值?

我知道任务返回一个标准错误的值,我可以通过输入"echo $?"看到 在手动运行任务后在终端中.

现在这段代码:

[aTask launch];
[aTask waitUntilExit];
int status = [aTask terminationStatus];
Run Code Online (Sandbox Code Playgroud)

看起来不错,但gdb说状态是0x0的位置,无法访问.有人知道Xcode中NSTask对象中的任何错误吗?难道我做错了什么?

谢谢你的回复.

cocoa objective-c

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

使用全局变量在类之间传递值

所以我的简单想法是创建一个应用程序,允许用户通过电子邮件报告其位置的纬度和经度坐标.您点击按钮,电子邮件屏幕通过MessageUI框架出现,To,Subject和Body字段已经预先输入,所需的只是用户点击"发送".

我的问题是,我需要将纬度和经度坐标包含在电子邮件正文中.这些坐标变量在 - (void)CLLocationManager函数中生成,并转换为字符串,就像我需要的那样.问题是,电子邮件是从另一个函数发送的, - (void)displayComposerSheet,我无法弄清楚如何将lat/long字符串放入要发送的电子邮件正文中.经过一段时间的冲击,我遇到了全局变量的想法.这似乎是我需要实现的.很多消息来源都说"在应用程序代理中声明你的变量,然后你就可以在代码中的任何地方使用它们",或者至少这就是我所说的意思.再说一遍,我会强调我对这个游戏很新.所以,

我只是不知道所有"东西"应该去哪里.这是我到目前为止所做的事情(完美无缺).我只需要用CLLocationManager生成的ACTUAL值替换我的默认纬度值"12.3456"和经度值"78.9012".任何帮助将不胜感激.谢谢!

//Code that generates the Latitude and Longitude strings
//--------------------------------------------------------
- (void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLocation
           fromLocation:(CLLocation *)oldLocation


{
    //Breaks down the location into degrees, minutes, and seconds.

    int degrees = newLocation.coordinate.latitude;
    double decimal = fabs(newLocation.coordinate.latitude - degrees);
    int minutes = decimal * 60;
    double seconds = decimal * 3600 - minutes * 60;
    NSString *lat = [NSString stringWithFormat:@"%d° %d' %1.4f\"",
                     degrees, minutes, seconds];    
    latitude.text = lat;
    degrees = newLocation.coordinate.longitude;
    decimal = fabs(newLocation.coordinate.longitude - degrees); …
Run Code Online (Sandbox Code Playgroud)

email iphone cocoa cocoa-touch objective-c

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

如何查看标签的文本值?

我现在真的很沮丧!我现在有一个新问题,我想要做的就是说

lblMessage.Text ="30 Seconds"然后做一些代码,否则做一些其他代码

if (lblMessage.text isEqualToString:@"30 Seconds")
{
    NSString *strPlayerAtTable = [[NSString alloc] initWithFormat:@"%@ at table", ActivePlayer];
    lblMessage.text = strPlayerAtTable;
}
else
if (nStopClockPos == 30)
{
    lblTime.textColor = [UIColor yellowColor];
    lblMessage.text = @"30 Seconds";
}
Run Code Online (Sandbox Code Playgroud)

我在isEqualToString之前得到错误预期

我必须将它放入一个新的字符串变量或什么?

干杯

保罗

iphone cocoa cocoa-touch objective-c

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

如何根据在iphone中保存为"key for object"的Date对可变数组进行排序?

我是iphone开发的新手.我最近有一个可变数组,其中诸如标题,日期,网址和摘要等值被存储为"密钥对象".密钥是myurl,mudate,mytitle,mysummary.我想要排序参考日期的可变数组并根据那些打印所有值.我怎么能实现这一点?请帮帮我.谢谢.

            [item setObject:currentTitle forKey:@"title"];
            [item setObject:currentLink forKey:@"link"];
            [item setObject:currentSummary forKey:@"description"];
            [item setObject:currentDate forKey:@"pubDate"];//
            [item setObject:currentImage forKey:@"imagePath"];

            [recent addObject:[item copy]];
Run Code Online (Sandbox Code Playgroud)

所有都是xml解析的内容.

sorting iphone cocoa cocoa-touch nsmutablearray

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

iPhone:如何修复一个真正糟糕的内存管理的传统iPhone应用程序?单元测试?

我最近继承了一个iPhone应用程序.最初的开发人员并不了解内存管理,而且应用程序在simlulator中运行,但在旧的iPhone上却没有(很多崩溃).您对我可以保存应用程序的过程有任何想法吗?

我可以利用或创建任何单位测试来查找内存泄漏并使过程"科学"吗?

谢谢

iphone cocoa-touch unit-testing memory-management objective-c

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