我有以下代码:
-(IBAction)showAlertView:(id)sender{
alertView = [[UIAlertView alloc] initWithTitle:@"Atualizando" message:@"\n"delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
spinner.center = CGPointMake(139.5, 75.5); // .5 so it doesn't blur
[alertView addSubview:spinner];
[spinner startAnimating];
[alertView show];
}
-(IBAction)getContacts:(id)sender {
[self showAlertView:(id)self];
ABAddressBookRef addressBook = ABAddressBookCreate( );
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople( addressBook );
CFIndex nPeople = ABAddressBookGetPersonCount( addressBook );
Run Code Online (Sandbox Code Playgroud)
我希望在IBAction的其余部分开始之前显示警报,但我只在IBAction结束时看到alertView.我究竟做错了什么?
编辑:我有:
-(IBAction)getContacts:(id)sender {
// display the alert view
[self showAlertView:self];
// do the synchronous operation on a different queue
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
ABAddressBookRef addressBook = …
Run Code Online (Sandbox Code Playgroud) 我正在尝试将以下代码与gomobile绑定,以将其导出为iOS框架。我已经成功完成了此操作,但是由于某种原因,以下代码在运行bind命令时给我错误gomobile:包中没有导出的名称。该代码作为go脚本运行时有效。
package request
import (
"net/url"
"fmt"
)
func requestEndpoint(number string) string {
safeNumber := url.QueryEscape(number)
url := fmt.Sprintf("http://apilayer.net/api/validate?access_key=690a581e85900555754fd7bfa70808b2&number=%s&country_code=&format=1", safeNumber)
return url
}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?谢谢!