Apple没有在Apple Developer网站上发布任何替代代码.
我正在使用NSMutableURLRequest将POST数据发送到使用SendGrid发送电子邮件的服务器端PHP脚本.这很好用.但是,我不知道如何正确打包UIImagedata作为附件发送.这是我目前的代码:
// Choose an image from your photo library
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
chosenImage = info[UIImagePickerControllerEditedImage]; // chosenImage = UIImage
pickedData = UIImagePNGRepresentation(chosenImage); // pickedData = NSData
attachment = TRUE;
[picker dismissViewControllerAnimated:YES completion:NULL];
}
-(void)sendMail {
toEmailAddress = @"blabla@blabla.com";
subject = @"Some Subject";
message = @"Some message...";
fullName = @"Mister Bla Bla";
if (attachment == TRUE) {
// Create NSData object as PNG image data from camera image
NSString *picAttachment = [NSString stringWithFormat:@"%lu",(unsigned long)[pickedData length]];
NSString *picName = …Run Code Online (Sandbox Code Playgroud) 这部电影播放得很好,但在播放之前就有一个快速的黑色闪光灯.这是将控制风格设置为MPMovieControlStyleNone的怪癖吗?
NSString *url = [[NSBundle mainBundle] pathForResource:@"00" ofType:@"mov"];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc]
initWithContentURL:[NSURL fileURLWithPath:url]];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
//---play video in implicit size---
player.view.frame = CGRectMake(80, 64, 163, 246);
[self.view addSubview:player.view];
// Hide video controls
player.controlStyle = MPMovieControlStyleNone;
//---play movie---
[player play];
Run Code Online (Sandbox Code Playgroud) 看起来avcapturevideopreviewlayer的方向已在iOS 6中折旧.任何人都知道新代码?这是我目前的(折旧)代码:
[self setPreviewLayer:[[AVCaptureVideoPreviewLayer alloc] initWithSession:[self captureSession]]];
[[self previewLayer] setVideoGravity:AVLayerVideoGravityResizeAspectFill];
previewLayer.orientation = UIInterfaceOrientationLandscapeRight;
Run Code Online (Sandbox Code Playgroud) 我在Xcode 4.6.3中创建了一个企业应用程序并将其发布在网站上.该应用程序成功下载到iPhone5和iPad3(都运行iOS 7).该应用程序运行正常.但是,它在两个无法删除的设备上创建了一个重复的"幻影"应用程序图标.请参阅屏幕捕获.
我尝试通过长按应用程序图标并触摸设备上的"X"来删除它.我也尝试在iTunes中删除它.没运气.我更新到为iOS 7开发的Xcode 5.0.1,重新编译并重复该过程.没运气.重复的图标仍然存在!
对于未运行iOS 7的设备,这不是问题.
我的代码成功地为我的整个音乐库编目歌曲名称和ID.但是,它实际上不会使用此方法播放歌曲,控制台显示以下内容:
消息播放状态超时.
消息nowPlayingItem超时.
self.musicPlayer = [MPMusicPlayerController applicationMusicPlayer];
MPMediaQuery *everything = [[MPMediaQuery alloc] init];
NSArray *itemsFromGenericQuery = [everything items];
SongName = [[NSMutableArray alloc] init];
SongItem = [[NSMutableArray alloc] init];
NSString *songTitle;
NSString *songID;
//Collect names & ID for entire music library & put into arrays
for (MPMediaItem *song in itemsFromGenericQuery) {
songTitle = [song valueForProperty: MPMediaItemPropertyTitle];
[SongName addObject:songTitle];
songID = [song valueForProperty: MPMediaItemPropertyPersistentID];
[SongItem addObject:songID];
}
NSLog (@"%@", [SongName objectAtIndex:1]);
NSLog (@"%@", [SongItem objectAtIndex:1]);
// Play the second song in the …Run Code Online (Sandbox Code Playgroud) ios ×3
ios4 ×2
iphone ×2
cocoa-touch ×1
duplicates ×1
enterprise ×1
php ×1
sendgrid ×1
xcode ×1