我已经在Apple引用的示例代码中看到了如何处理Core Data错误.即:
NSError *error = nil;
if (![context save:&error]) {
/*
Replace this implementation with code to handle the error appropriately.
abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. If it is not possible to recover from the error, display an alert panel that instructs the user to quit the application by pressing the Home button.
*/
NSLog(@"Unresolved error %@, …Run Code Online (Sandbox Code Playgroud) 我需要将一系列用户输入的单词与一个大的单词词典相匹配(以确保输入的值存在).
因此,如果用户输入:
"orange" it should match an entry "orange' in the dictionary.
Run Code Online (Sandbox Code Playgroud)
现在的问题是用户还可以输入通配符或一系列通配符,比如说
"or__ge" which would also match "orange"
Run Code Online (Sandbox Code Playgroud)
关键要求是:
* this should be as fast as possible.
* use the smallest amount of memory to achieve it.
Run Code Online (Sandbox Code Playgroud)
如果单词列表的大小很小,我可以使用包含所有单词的字符串并使用正则表达式.
但是,鉴于单词列表可能包含数十万个企业,我认为这不会起作用.
那么某种"树"是这样的方式......?
对此有任何想法或建议将完全赞赏!
先谢谢,马特
我正在努力让Maven与ProGuard合作.
我想要实现的目标如下:
在我的源文件上运行ProGuard并生成混淆的类
创建一个引用主类的清单文件,以便我可以将其作为jar执行
解压缩所有相关的库jar并创建一个包含它们的巨大jar.此文件只应与.class和.xml文件联系.
将它们组装成包含各种README.txt文件的.zip和tar.gz文件,依此类推.
到目前为止,我有这样的事情:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<configuration>
<archive>
<manifest>
<mainClass>com.class.path.MainClass</mainClass>
</manifest>
</archive>
<includes>
<include>**/*.class</include>
<include>**/*.xml</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>com.pyx4me</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<configuration>
<options>
<option>-allowaccessmodification</option>
</options>
<obfuscate>true</obfuscate>
<injar>classes</injar>
<outjar>${project.build.finalName}.jar</outjar>
<outputDirectory>${project.build.directory}</outputDirectory>
<proguardInclude>src/main/assembly/proguard.conf</proguardInclude>
<libs>
lib/rt.jar</lib>
</libs>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>assembly</id>
<phase>package</phase>
<goals>
<goal>assembly</goal>
</goals>
<configuration>
<descriptors>
<descriptor>
src/main/assembly/bin.xml
</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
但我没有快乐.任何人都可以给我任何模糊的指示吗?
先谢谢,马特
好一点新手类型的问题.
我想使用Core Data以及Tab和Navigation控制器.
在XCode中,如果我创建基于导航的应用程序,我可以选择核心数据.而如果我创建一个标签栏应用程序,我无法做出选择.
我知道Tab Bars显示视图控制器,所以它有点意义.但是,鉴于默认情况下它将基本的核心数据代码粘贴在应用程序委托中,我不明白为什么不提供此代码.
目前我正在创建这两个项目并在它们之间剪切和粘贴.
XCode中的这个遗漏对你来说有点奇怪吗?这是某种疏忽吗?
谢谢,马特
iphone xcode core-data uinavigationcontroller tabbarcontroller
我一直收到 - >程序接收信号:"EXC_BAD_ACCESS".
在下面的代码中,但我真的不明白为什么.
如果我注释掉"executeFetchRequest"行,它就会消失.
不应该[结果发布]; 是所需要的吗?
先谢谢,马特
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
// fetch the delegate
TestingAppDelegate *app = (TestingAppDelegate *)[[UIApplication sharedApplication] delegate];
NSManagedObjectContext *managedObjectContext = [app managedObjectContext];
// construct the request
NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
[request setEntity:[NSEntityDescription entityForName:@"Client" inManagedObjectContext:managedObjectContext]];
NSError *error;
NSArray *results = [managedObjectContext executeFetchRequest:request error:&error];
[results release];
}
Run Code Online (Sandbox Code Playgroud) core-data ×3
iphone ×3
algorithm ×1
assemblies ×1
java ×1
maven-2 ×1
memory-leaks ×1
performance ×1
plugins ×1
proguard ×1
xcode ×1