int (*MobileInstallationBrowse)(NSDictionary *options, int (*callback)(NSDictionary *dict, id value), id value);
static int callback(NSDictionary *dict, id result)
{
NSArray *currentlist = [dict objectForKey:@"CurrentList"];
if (currentlist)
{
for (NSDictionary *appinfo in currentlist)
{
[(NSMutableArray*)result addObject:[appinfo copy]];
}
}
return 0;
}
-(IBAction)btnGetApp:(UIButton *)sender
{
NSMutableArray *result = [NSMutableArray new];
MobileInstallationBrowse([NSDictionary dictionaryWithObject:@"Any" forKey:@"ApplicationType"],&callback, result); //Any 代表所有程序,这里可以用 “System” “User”来区分系统和普通软件
}
为什么运行红色那行代码时提示:
error: address doesn't contain a section that points to a section in a object file
------解决方案--------------------
晕,发错了,看红色那块代码
int (*MobileInstallationBrowse)(NSDictionary *options, int (*callback)(NSDictionary *dict, id value), id value);
int MobileInstallationBrowseImplementation(NSDictionary *options, int (*callback)(NSDictionary *dict, id value), id value)
{
NSLog(@"MobileInstallationBrowseImplementation");
return 0;
}
static int callback(NSDictionary *dict, id result)
{
NSArray *currentlist = [dict objectForKey:@"CurrentList"];
if (currentlist)
{
for (NSDictionary *appinfo in currentlist)
{
[(NSMutableArray*)result addObject:[appinfo copy]];
}
}
return 0;
}
-(void)btnGetApp
{
NSMutableArray *result = [NSMutableArray new];
MobileInstallationBrowse = MobileInstallationBrowseImplementation;
MobileInstallationBrowse([NSDictionary dictionaryWithObject:@"Any" forKey:@"ApplicationType"], callback, result); //Any 代表所有程序,这里可以用 “System” “User”来区分系统和普通软件
}