0

我正在为读取联系人列表的 iPhone 编写扩展程序 (ANE)。将 .ane 添加到我的 Flash Builder 项目并对其进行编译时,我收到一个错误。我在 *.a 库中编译了 Objective-c 代码,没有问题。我编译了.ane,没有错误。

这是我在主 Flex 项目中添加 .ane 时的错误:

Error occurred while packaging the application:

ld: absolute addressing (perhaps -mdynamic-no-pic) used in _getContatti from
/var/folders/j9/j9OzOTqhGJGpr2m87bnYEU+++TQ/-Tmp-/888e0e80-9ef5-4d2a-9e34-
c01545b25bfc/mylib.library.com.a(ExtensionMyLibIOSNative.o) 
not allowed in slidable image. Use '-read_only_relocs suppress' to enable text 
relocs
Compilation failed while executing : ld64

在 Xcode 中,我已经在构建设置中将“启用与共享库的链接”设置为“否”。这是导致错误的 Objective-c 代码:

FREObject getContatti(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]) {

FREObject nome_visualizzato;
FREObject nome_visualizzatoPrimario;
FREObject nome_visualizzatoAlternativo;

ABAddressBookRef addressBook = ABAddressBookCreate( );
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople( addressBook );
CFIndex nPeople = ABAddressBookGetPersonCount( addressBook );

FREObject arrayContatti;
FRENewObject((const uint8_t*)"Vector.<extension.MyLibrary.entity.Contatto>", 0, NULL, &arrayContatti, NULL);
FRESetArrayLength(arrayContatti, nPeople);


for ( int i = 0; i < nPeople; i++ )
{
    ABRecordRef ref = CFArrayGetValueAtIndex( allPeople, i );
    CFStringRef first = ABRecordCopyValue(ref, kABPersonFirstNameProperty);
    CFStringRef last = ABRecordCopyValue(ref, kABPersonLastNameProperty);
    CFStringRef company = ABRecordCopyValue(ref, kABPersonOrganizationProperty);
    -- DO SOMETHING --
}
    return result;
}

如果我评论\删除行,它会起作用:

CFStringRef first = ABRecordCopyValue(ref, kABPersonFirstNameProperty);
CFStringRef last = ABRecordCopyValue(ref, kABPersonLastNameProperty);
CFStringRef company = ABRecordCopyValue(ref, kABPersonOrganizationProperty);
4

1 回答 1

0
  1. Check if AddressBook framework (and possibly AddressBookUI, if you are using any views from AddressBook) is included in your project in 'link binary with libraries' (you can find it here: http://wordpress.rcntech.com/wp-content/uploads/2011/05/Xcode4_Adding_Existing_Framework3.png) Try setting 'enable linking with shared libraries' to yes (if it is set to 'no') Add required frameworks to platform options when compiling the ane (if they are not included in air already)

Alternatively, since you are trying to access AddressBook, you can check this extension: https://github.com/memeller/ContactEditor

于 2012-05-23T10:45:20.290 回答