Compress Image in iOS 12. How will this code be updated? [duplicate]
This question already has an answer here:
UIImageJPEGRepresentation has been replaced by instance method UIImage.jpegData(compressionQuality:)
3 answers
// compressing image(avaImg)before sending it to the server(Parse)
let avaData = UIImageJPEGRepresentation(avaImg.image!, 0.5)
let avaFile = PFFile(name: "ava.jpg", data: avaData!)
user["ava"] = avaFile
When I replace it to the following line as recommended by the notifications I get the error below
let avaData = UIImage.jpegData(avaImg.image!, 0.5)
ERROR: Instance member 'jpegData' cannot be used on type 'UIImage'; did you mean to use a value of this type instead?
I'm a newbie and I followed that on an online course so please baby steps!
swift uiimage ios12
marked as duplicate by rmaddy
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Aug 31 '18 at 13:50
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
UIImageJPEGRepresentation has been replaced by instance method UIImage.jpegData(compressionQuality:)
3 answers
// compressing image(avaImg)before sending it to the server(Parse)
let avaData = UIImageJPEGRepresentation(avaImg.image!, 0.5)
let avaFile = PFFile(name: "ava.jpg", data: avaData!)
user["ava"] = avaFile
When I replace it to the following line as recommended by the notifications I get the error below
let avaData = UIImage.jpegData(avaImg.image!, 0.5)
ERROR: Instance member 'jpegData' cannot be used on type 'UIImage'; did you mean to use a value of this type instead?
I'm a newbie and I followed that on an online course so please baby steps!
swift uiimage ios12
marked as duplicate by rmaddy
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Aug 31 '18 at 13:50
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
let avaData = avaImg.image!.jpegData(avaImg.image!, 0.5)
– Faris
Dec 10 '18 at 1:58
add a comment |
This question already has an answer here:
UIImageJPEGRepresentation has been replaced by instance method UIImage.jpegData(compressionQuality:)
3 answers
// compressing image(avaImg)before sending it to the server(Parse)
let avaData = UIImageJPEGRepresentation(avaImg.image!, 0.5)
let avaFile = PFFile(name: "ava.jpg", data: avaData!)
user["ava"] = avaFile
When I replace it to the following line as recommended by the notifications I get the error below
let avaData = UIImage.jpegData(avaImg.image!, 0.5)
ERROR: Instance member 'jpegData' cannot be used on type 'UIImage'; did you mean to use a value of this type instead?
I'm a newbie and I followed that on an online course so please baby steps!
swift uiimage ios12
This question already has an answer here:
UIImageJPEGRepresentation has been replaced by instance method UIImage.jpegData(compressionQuality:)
3 answers
// compressing image(avaImg)before sending it to the server(Parse)
let avaData = UIImageJPEGRepresentation(avaImg.image!, 0.5)
let avaFile = PFFile(name: "ava.jpg", data: avaData!)
user["ava"] = avaFile
When I replace it to the following line as recommended by the notifications I get the error below
let avaData = UIImage.jpegData(avaImg.image!, 0.5)
ERROR: Instance member 'jpegData' cannot be used on type 'UIImage'; did you mean to use a value of this type instead?
I'm a newbie and I followed that on an online course so please baby steps!
This question already has an answer here:
UIImageJPEGRepresentation has been replaced by instance method UIImage.jpegData(compressionQuality:)
3 answers
swift uiimage ios12
swift uiimage ios12
edited Aug 31 '18 at 13:51
rmaddy
241k27316380
241k27316380
asked Aug 31 '18 at 13:19
Marisabel GonzalezMarisabel Gonzalez
1813
1813
marked as duplicate by rmaddy
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Aug 31 '18 at 13:50
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by rmaddy
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Aug 31 '18 at 13:50
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
let avaData = avaImg.image!.jpegData(avaImg.image!, 0.5)
– Faris
Dec 10 '18 at 1:58
add a comment |
let avaData = avaImg.image!.jpegData(avaImg.image!, 0.5)
– Faris
Dec 10 '18 at 1:58
let avaData = avaImg.image!.jpegData(avaImg.image!, 0.5)
– Faris
Dec 10 '18 at 1:58
let avaData = avaImg.image!.jpegData(avaImg.image!, 0.5)
– Faris
Dec 10 '18 at 1:58
add a comment |
1 Answer
1
active
oldest
votes
Do you mean swift 4.2?
Call it like this yourImageObject.jpegData(compressionQuality: 0.5) because function changed to public func jpegData(compressionQuality: CGFloat) -> Data? For more syntax I have a repo your can take a reference with changes from swift 4. https://github.com/alexliubj/Swift-Migration-4.2
This API change is from iOS 12, not Swift 4.2.
– rmaddy
Aug 31 '18 at 13:52
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Do you mean swift 4.2?
Call it like this yourImageObject.jpegData(compressionQuality: 0.5) because function changed to public func jpegData(compressionQuality: CGFloat) -> Data? For more syntax I have a repo your can take a reference with changes from swift 4. https://github.com/alexliubj/Swift-Migration-4.2
This API change is from iOS 12, not Swift 4.2.
– rmaddy
Aug 31 '18 at 13:52
add a comment |
Do you mean swift 4.2?
Call it like this yourImageObject.jpegData(compressionQuality: 0.5) because function changed to public func jpegData(compressionQuality: CGFloat) -> Data? For more syntax I have a repo your can take a reference with changes from swift 4. https://github.com/alexliubj/Swift-Migration-4.2
This API change is from iOS 12, not Swift 4.2.
– rmaddy
Aug 31 '18 at 13:52
add a comment |
Do you mean swift 4.2?
Call it like this yourImageObject.jpegData(compressionQuality: 0.5) because function changed to public func jpegData(compressionQuality: CGFloat) -> Data? For more syntax I have a repo your can take a reference with changes from swift 4. https://github.com/alexliubj/Swift-Migration-4.2
Do you mean swift 4.2?
Call it like this yourImageObject.jpegData(compressionQuality: 0.5) because function changed to public func jpegData(compressionQuality: CGFloat) -> Data? For more syntax I have a repo your can take a reference with changes from swift 4. https://github.com/alexliubj/Swift-Migration-4.2
answered Aug 31 '18 at 13:49
Alex LAlex L
20328
20328
This API change is from iOS 12, not Swift 4.2.
– rmaddy
Aug 31 '18 at 13:52
add a comment |
This API change is from iOS 12, not Swift 4.2.
– rmaddy
Aug 31 '18 at 13:52
This API change is from iOS 12, not Swift 4.2.
– rmaddy
Aug 31 '18 at 13:52
This API change is from iOS 12, not Swift 4.2.
– rmaddy
Aug 31 '18 at 13:52
add a comment |
let avaData = avaImg.image!.jpegData(avaImg.image!, 0.5)
– Faris
Dec 10 '18 at 1:58