我在我的主app文件中写了这样的内容,也与扩展程序共享。
Detect whether run target is App Extension or iOS App
#ifdef SHARE_EXTENSION
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:APP_NAME message:@"You only have 1 photo. Confirm deletion? (Please note that you have to submit at least 1 photo for iFeedback)." delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
[alert show];
#endif
然而,它仍然给我一个错误,说UIAlertview不能用于扩展。我也需要共享该文件,并且不会仅为此代码创建另一个相同的文件。我该怎么检查?