我不知道如何从地址簿创建vCard.我可以通过搜索为vCard数据生成NSString,但我不知道如何将NSString转换为.vcf.这是我的vCard数据NSString的代码.
NSString *vcard = @"BEGIN:VCARD\nVERSION:3.0\n";
// Name
vcard = [vcard stringByAppendingFormat:@"N:%@;%@;%@;%@;%@\n",
(contact.lastname ? contact.lastname : @""),
(contact.firstname ? contact.firstname : @""),
(contact.middlename ? contact.middlename : @""),
(contact.prefix ? contact.prefix : @""),
(contact.suffix ? contact.suffix : @"")
];
vcard = [vcard stringByAppendingFormat:@"FN:%@\n",contact.compositeName];
if( contact.nickname ) vcard = [vcard stringByAppendingFormat:@"NICKNAME:%@\n",contact.nickname];
if( contact.firstnamephonetic ) vcard = [vcard stringByAppendingFormat:@"X-PHONETIC-FIRST-NAME:%@\n",contact.firstnamephonetic];
if( contact.lastnamephonetic ) vcard = [vcard stringByAppendingFormat:@"X-PHONETIC-LAST-NAME:%@\n",contact.lastnamephonetic];
// Work
if( contact.organization || contact.department ) vcard = [vcard stringByAppendingFormat:@"ORG:%@;%@\n",(contact.organization?contact.organization:@""),(contact.department?contact.department:@"")];
if( contact.jobtitle ) vcard = [vcard stringByAppendingFormat:@"TITLE:%@\n",contact.jobtitle]; …Run Code Online (Sandbox Code Playgroud) 我正在开发应用程序,我在其中存储NSDictionary中的文件名和文件路径.我的字典就像,
Dict Path : {
background = "file://localhost/var/mobile/Applications/6118A03F-345B-42D5-AC19-25F6D9AC4484/Documents/background.caf";
bgMusic = "file://localhost/var/mobile/Applications/6118A03F-345B-42D5-AC19-25F6D9AC4484/Documents/bgMusic.caf";
}
Run Code Online (Sandbox Code Playgroud)
它工作正常,但当我尝试在JSON字符串中转换字典时,
NSString *strPathForSong = [json stringWithObject:dictPath];
NSLog(@"path sting : %@",strPathForSong);
Run Code Online (Sandbox Code Playgroud)
它返回null字符串.那么有没有办法将带有"/"字符串的字典转换为json字符串?先感谢您
我已经尝试过解除UIImagePickerController的每一个变种都没有运气.我究竟做错了什么.
- (IBAction)choosePhoto
{
self.picker = [[UIImagePickerController alloc] init];
self.picker.delegate = self;
self.picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:self.picker animated:YES];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)imagePicker
{
NSLog(@"dismiss image picker");
[self dismissModalViewControllerAnimated:NO];
[[self.picker parentViewController] dismissModalViewControllerAnimated:NO];
[self.presentedViewController dismissModalViewControllerAnimated:NO];
[self.presentingViewController dismissModalViewControllerAnimated:NO];
// And every other way i could think of
}
- (void)imagePickerController:(UIImagePickerController *)imagePicker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
.. same stuff here
}
Run Code Online (Sandbox Code Playgroud)
我试图从父,祖父母,navigationController和根控制器呈现选择器,没有任何作用.我做什么我不能解雇ImagePickerController.
请注意每次都会调用log语句.
干杯
我正在创建一个应用程序,我正在尝试使用Google图像搜索API实现谷歌图像搜索.我推荐[google API链接](https://developers.google.com/image-search/v1/).但是我在该页面上提到了一个问题(DEPRECATED).我可以使用此API,还是应该使用其他API?任何人都可以知道吗?
先感谢您
我的项目中有以下代码
- (BOOL)peoplePickerNavigationController:
(ABPeoplePickerNavigationController *)peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person {
[popContactsForm dismissPopoverAnimated:YES];
[ssemailvc setName: (NSString *)ABRecordCopyValue(person,kABPersonFirstNameProperty)];
ABMultiValueRef emails = (NSString *)ABRecordCopyValue(person,kABPersonEmailProperty);
if (ABMultiValueGetCount(emails)>0) {
[ssemailvc setEmail:(NSString *)ABMultiValueCopyValueAtIndex(emails,0)];
}else [ssemailvc setEmail:@""];
CFRelease(emails);
[peoplePicker dismissModalViewControllerAnimated:YES];
[popEmailForm setPopoverContentSize:CGSizeMake(350.0, 225.0)];
return NO;
}
Run Code Online (Sandbox Code Playgroud)
我收到了警告
1.call to function'ABRecordCopyValue'返回一个corefoundation对象,其中+1保留计数2.object泄露:在执行的后期没有引用已分配的对象,并且保留计数为+1
请告诉我如何克服这个问题
我需要我的一个应用内购买是免费的,可能是Apple IAP结构提供的吗?
目前购买的类型是non-consumable支付一切都没关系,但问题是,如果我从价格层"免费",我收到它的ID invalidProductIdentifiers.
我实际上是尝试从xCode 4.6在4.3模拟器中运行我的应用程序.我在路径上复制模拟器4.3的sdk,它构建成功,但无法在模拟器中运行应用程序.那么现在我该怎么做才能解决问题呢?先感谢您
我UINAvigatoinBar用十六进制颜色设置我的颜色:
self.navigationController.navigationBar.barTintColor = UIColorFromRGB(0x212121);
Run Code Online (Sandbox Code Playgroud)
它运行良好,IOS7但在较低版本中崩溃与以下:
[UINavigationBar setBarTintColor:]: unrecognized selector sent to instance
Run Code Online (Sandbox Code Playgroud)
我该怎么办?
我有以下代码:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIImage * search = [UIImage imageNamed: @"search.png"];
UIImageView * s = [[UIImageView alloc] initWithImage: search];
s.frame = CGRectMake(15, 14, search.size.width, search.size.height);
UIImage * simg = [UIImage imageNamed: @"m_search_back.png"];
UIImage * img = [UIImage imageNamed: @"m_top.png"];
CGRect searchBarFrame = CGRectMake(0, 0, self.tableView.frame.size.width, 45.0);
self.searchBar = [[UISearchBar alloc] initWithFrame:searchBarFrame];
self.searchBar.backgroundImage = simg;
[self.searchBar setSearchFieldBackgroundImage: simg forState:UIControlStateNormal];
self.searchBar.delegate = self;
[self.searchBar addSubview: s];
UITextField *searchField = [self.searchBar valueForKey:@"_searchField"];
// Change search bar text color
searchField.textColor = …Run Code Online (Sandbox Code Playgroud) 我试图一个接一个地关闭两个视图控制器,在我的第一个视图控制器中,我一直保持上传功能,当完成当前视图控制器时,它被解除.
现在,在上传ViewController被解雇之后,我来到了之前的viewcontroller.我想解雇那个"previousViewController".
解除"uploadViewController"后,我在"PreviousViewController"上调用方法
以下是我尝试这样做的方法:
在UploadViewController中:
[self dismissViewControllerAnimated:YES completion:^{
[previousView dismissME];
}];
Run Code Online (Sandbox Code Playgroud)
现在,当我来到"PreviousViewController"
这是dismissME方法:
-(void)dismissME {
if (![[self presentingViewController] isBeingDismissed]) {
NSLog(@"Dismiss ME");
[self dismissViewControllerAnimated:YES completion:NULL];
}
}
Run Code Online (Sandbox Code Playgroud)
我得到了"Dismiss ME"日志,但是viewController没有被解雇.
有任何想法吗 .. ?怎么实现这个..?