2010-05-26 74 views
0

任何人可以提供一些線索,爲什麼是我的應用程序在iPhone OS以下錯誤2.2.1向後兼容使用核心數據

dyld: Symbol not found: _OBJC_CLASS_$_NSPredicate 
    Referenced from: /var/mobile/Applications/456F243F-468A-4969-9BB7-A4DF993AE89C/AppName.app/AppName 
    Expected in: /System/Library/Frameworks/Foundation.framework/Foundation 

我有微弱的聯繫CoreData.framework崩潰,並讓基地SDK設置爲3.0,部署目標設置爲SDK 2.2

該應用程序已經使用其他3.0功能,如果可用,我沒有任何問題。但顯然,用於其他功能的向後兼容性方法不適用於Core Data。

應用程序委託的applicationDidFinishLaunching被調用之前,應用程序崩潰。

這裏的調試日誌:

[Session started at 2010-05-25 20:17:03 -0400.] 
GNU gdb 6.3.50-20050815 (Apple version gdb-1119) (Thu May 14 05:35:37 UTC 2009) 
Copyright 2004 Free Software Foundation, Inc. 
GDB is free software, covered by the GNU General Public License, and you are 
welcome to change it and/or distribute copies of it under certain conditions. 
Type "show copying" to see the conditions. 
There is absolutely no warranty for GDB. Type "show warranty" for details. 
This GDB was configured as "--host=i386-apple-darwin --target=arm-apple-darwin".tty /dev/ttys001 
Loading program into debugger… 
sharedlibrary apply-load-rules all 
warning: Unable to read symbols from "MessageUI" (not yet mapped into memory). 
warning: Unable to read symbols from "CoreData" (not yet mapped into memory). 
Program loaded. 
target remote-mobile /tmp/.XcodeGDBRemote-12038-42 
Switching to remote-macosx protocol 
mem 0x1000 0x3fffffff cache 
mem 0x40000000 0xffffffff none 
mem 0x00000000 0x0fff none 
run 
Running… 
[Switching to thread 10755] 
[Switching to thread 10755] 
Re-enabling shared library breakpoint 1 
Re-enabling shared library breakpoint 2 
Re-enabling shared library breakpoint 3 
Re-enabling shared library breakpoint 4 
Re-enabling shared library breakpoint 5 
(gdb) continue 
warning: Unable to read symbols for ""/Users/alex/iPhone Projects/AppName/build/Debug-iphoneos"/AppName.app/AppName" (file not found). 
dyld: Symbol not found: _OBJC_CLASS_$_NSPredicate 
    Referenced from: /var/mobile/Applications/456F243F-468A-4969-9BB7-A4DF993AE89C/AppName.app/AppName 
    Expected in: /System/Library/Frameworks/Foundation.framework/Foundation 

(gdb) 

回答

0

不好意思,剛纔重讀你的問題。它看起來像框架本身不能弱鏈接。我想這意味着你不能與Core Data框架:(

2.x版本的目標,即整個框架是不可用的目標平臺上,弱連接不適用。

+0

感謝您的回答。對於3.0引入的其他框架,例如MediaPlayer和MessageUI,情況不一樣嗎?它們也不存在於目標平臺上。 – 2010-05-26 01:56:52

+0

也許吧。這可能是因爲您無意中使用了「NSPredicate」,它不是特別的Core Data,而是由它提供的。你是否確認'applicationDidFinishLaunching'沒有到達斷點?是否有鏈接/使用需要「NSPredicate」的任何類別類別? – ohhorob 2010-05-26 02:37:54

+0

在其他地方不使用NSPredicate。我在applicationDidFinishLaunching的開始處設置斷點,並在應用程序擊中它之前崩潰。 – 2010-05-26 04:41:01

1

顯然,你可以「T參考NSPredicate用文字類符號,如果你不會有與iPhone OS向後兼容2.2

因此改變了我的參考NSPredicate到:

[fetchRequest setPredicate:[NSClassFromString(@"NSPredicate") predicateWithFormat:@"EntryId == %@", [NSNumber numberWithInt: index]]]; 

和現在的工作

請參閱https://devforums.apple.com/message/225591#225591